summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.editorconfig14
-rw-r--r--.git-blame-ignore-revs4
-rw-r--r--.github/workflows/build.yaml36
-rwxr-xr-x.gitignore1
-rw-r--r--autobuild.xml152
-rwxr-xr-xbuild.sh38
-rw-r--r--indra/cmake/00-Common.cmake118
-rw-r--r--indra/cmake/Audio.cmake7
-rw-r--r--indra/cmake/Boost.cmake3
-rw-r--r--indra/cmake/CEFPlugin.cmake5
-rw-r--r--indra/cmake/CMakeLists.txt1
-rw-r--r--indra/cmake/ConfigurePkgConfig.cmake74
-rw-r--r--indra/cmake/Copy3rdPartyLibs.cmake12
-rw-r--r--indra/cmake/FindPipeWire.cmake100
-rw-r--r--indra/cmake/FreeType.cmake2
-rw-r--r--indra/cmake/GLIB.cmake22
-rw-r--r--indra/cmake/GStreamer10Plugin.cmake27
-rw-r--r--indra/cmake/LLAddBuildTest.cmake7
-rw-r--r--indra/cmake/LLWindow.cmake12
-rw-r--r--indra/cmake/Linker.cmake11
-rw-r--r--indra/cmake/Linking.cmake1
-rw-r--r--indra/cmake/Meshoptimizer.cmake2
-rw-r--r--indra/cmake/NDOF.cmake4
-rw-r--r--indra/cmake/Tracy.cmake12
-rw-r--r--indra/cmake/UI.cmake33
-rw-r--r--indra/cmake/Variables.cmake2
-rw-r--r--indra/cmake/ViewerMiscLibs.cmake8
-rwxr-xr-xindra/lib/python/indra/util/llmanifest.py2
-rw-r--r--indra/linux_crash_logger/llcrashloggerlinux.cpp48
-rw-r--r--indra/llappearance/llavatarappearancedefines.cpp4
-rw-r--r--indra/llappearance/llpolymesh.cpp2
-rw-r--r--indra/llappearance/llwearable.cpp14
-rw-r--r--indra/llappearance/llwearabledata.cpp34
-rw-r--r--indra/llcommon/CMakeLists.txt1
-rw-r--r--indra/llcommon/always_return.h17
-rw-r--r--indra/llcommon/llapp.cpp8
-rw-r--r--indra/llcommon/llapp.h8
-rw-r--r--indra/llcommon/llapr.h3
-rw-r--r--indra/llcommon/llcoros.cpp56
-rw-r--r--indra/llcommon/llerror.cpp2
-rw-r--r--indra/llcommon/llerror.h11
-rw-r--r--indra/llcommon/llexception.cpp41
-rw-r--r--indra/llcommon/llexception.h118
-rw-r--r--indra/llcommon/llfile.cpp2
-rw-r--r--indra/llcommon/llmutex.h12
-rw-r--r--indra/llcommon/llpreprocessor.h16
-rw-r--r--indra/llcommon/llprocess.h3
-rw-r--r--indra/llcommon/llprocessor.cpp75
-rw-r--r--indra/llcommon/llrand.cpp25
-rw-r--r--indra/llcommon/llsdutil.cpp7
-rw-r--r--indra/llcommon/llstacktrace.cpp2
-rw-r--r--indra/llcommon/llstring.cpp11
-rw-r--r--indra/llcommon/llsys.cpp81
-rw-r--r--indra/llcommon/lltimer.cpp2
-rw-r--r--indra/llcommon/lluuid.cpp3
-rw-r--r--indra/llcommon/llwin32headers.h11
-rw-r--r--indra/llcommon/llwin32headerslean.h40
-rw-r--r--indra/llcommon/tests/llleap_test.cpp2
-rw-r--r--indra/llcommon/tests/llstring_test.cpp4
-rw-r--r--indra/llcorehttp/CMakeLists.txt1
-rwxr-xr-xindra/llcorehttp/tests/llcorehttp_test.cpp5
-rw-r--r--indra/llfilesystem/tests/lldir_test.cpp31
-rw-r--r--indra/llimage/llimage.h2
-rw-r--r--indra/llimage/llimagefilter.cpp5
-rw-r--r--indra/llimagej2coj/llimagej2coj.cpp1
-rw-r--r--indra/llinventory/llsettingsbase.cpp113
-rw-r--r--indra/llinventory/llsettingsbase.h128
-rw-r--r--indra/llinventory/llsettingsdaycycle.cpp47
-rw-r--r--indra/llinventory/llsettingsdaycycle.h12
-rw-r--r--indra/llinventory/llsettingssky.cpp654
-rw-r--r--indra/llinventory/llsettingssky.h71
-rw-r--r--indra/llinventory/llsettingswater.cpp107
-rw-r--r--indra/llinventory/llsettingswater.h103
-rw-r--r--indra/llmath/llcalcparser.h6
-rw-r--r--indra/llmath/llrigginginfo.h4
-rw-r--r--indra/llmath/llsdutil_math.cpp3
-rw-r--r--indra/llmessage/llhost.cpp3
-rw-r--r--indra/llmessage/lliopipe.h2
-rw-r--r--indra/llmessage/lliosocket.h2
-rw-r--r--indra/llmessage/llmail.cpp1
-rw-r--r--indra/llmessage/llnamevalue.cpp1
-rw-r--r--indra/llmessage/llproxy.cpp6
-rw-r--r--indra/llmessage/net.cpp2
-rw-r--r--indra/llplugin/CMakeLists.txt8
-rw-r--r--indra/llplugin/llpluginclassmedia.cpp9
-rw-r--r--indra/llplugin/llpluginclassmedia.h4
-rw-r--r--indra/llplugin/llpluginprocessparent.cpp8
-rw-r--r--indra/llprimitive/lldaeloader.cpp40
-rw-r--r--indra/llprimitive/llmodel.cpp23
-rw-r--r--indra/llprimitive/llmodel.h9
-rw-r--r--indra/llprimitive/llmodelloader.cpp27
-rw-r--r--indra/llprimitive/llmodelloader.h41
-rw-r--r--indra/llprimitive/llprimtexturelist.cpp9
-rw-r--r--indra/llrender/llfontfreetype.cpp10
-rw-r--r--indra/llrender/llfontfreetypesvg.cpp4
-rw-r--r--indra/llrender/llfontfreetypesvg.h6
-rw-r--r--indra/llrender/llfontgl.cpp61
-rw-r--r--indra/llrender/llfontgl.h4
-rw-r--r--indra/llrender/llgl.cpp20
-rw-r--r--indra/llrender/llgl.h1
-rw-r--r--indra/llrender/llglheaders.h37
-rw-r--r--indra/llrender/llrender.cpp232
-rw-r--r--indra/llrender/llrender.h10
-rw-r--r--indra/llrender/llrender2dutils.cpp546
-rw-r--r--indra/llrender/llrendersphere.cpp62
-rw-r--r--indra/llrender/llrendersphere.h1
-rw-r--r--indra/llrender/llvertexbuffer.cpp390
-rw-r--r--indra/llui/llbadge.cpp12
-rw-r--r--indra/llui/llfloater.cpp24
-rw-r--r--indra/llui/llfolderview.cpp2
-rw-r--r--indra/llui/llfolderviewitem.cpp116
-rw-r--r--indra/llui/llfolderviewitem.h9
-rw-r--r--indra/llui/llstatbar.cpp10
-rw-r--r--indra/llui/lltextbase.cpp98
-rw-r--r--indra/llui/lltextbase.h15
-rw-r--r--indra/llui/lltrans.cpp20
-rw-r--r--indra/llui/lltrans.h18
-rw-r--r--indra/llui/llview.cpp6
-rw-r--r--indra/llwindow/CMakeLists.txt9
-rw-r--r--indra/llwindow/lldragdropwin32.h4
-rw-r--r--indra/llwindow/llkeyboard.cpp12
-rw-r--r--indra/llwindow/llkeyboard.h18
-rw-r--r--indra/llwindow/llkeyboardheadless.cpp8
-rw-r--r--indra/llwindow/llkeyboardheadless.h9
-rw-r--r--indra/llwindow/llkeyboardsdl.cpp451
-rw-r--r--indra/llwindow/llkeyboardsdl.h24
-rw-r--r--indra/llwindow/llkeyboardwin32.cpp2
-rw-r--r--indra/llwindow/llwindowsdl.cpp1653
-rw-r--r--indra/llwindow/llwindowsdl.h336
-rw-r--r--indra/llwindow/llwindowwin32.cpp21
-rw-r--r--indra/llwindow/llwindowwin32.h2
-rw-r--r--indra/llxml/llxmltree.cpp13
-rw-r--r--indra/media_plugins/CMakeLists.txt3
-rw-r--r--indra/media_plugins/base/CMakeLists.txt7
-rw-r--r--indra/media_plugins/base/media_plugin_base.cpp97
-rw-r--r--indra/media_plugins/base/media_plugin_base.h41
-rw-r--r--indra/media_plugins/cef/CMakeLists.txt43
-rw-r--r--indra/media_plugins/cef/linux/volume_catcher_linux.cpp78
-rw-r--r--indra/media_plugins/cef/linux/volume_catcher_linux.h149
-rwxr-xr-xindra/media_plugins/cef/linux/volume_catcher_pipewire.cpp333
-rw-r--r--indra/media_plugins/cef/linux/volume_catcher_pipewire_syms.inc26
-rwxr-xr-xindra/media_plugins/cef/linux/volume_catcher_pulseaudio.cpp322
-rwxr-xr-xindra/media_plugins/cef/linux/volume_catcher_pulseaudio_glib_syms.inc10
-rwxr-xr-xindra/media_plugins/cef/linux/volume_catcher_pulseaudio_syms.inc29
-rw-r--r--indra/media_plugins/cef/media_plugin_cef.cpp41
-rw-r--r--indra/media_plugins/cef/volume_catcher.h15
-rw-r--r--indra/media_plugins/cef/volume_catcher_null.cpp (renamed from indra/media_plugins/cef/mac_volume_catcher_null.cpp)44
-rw-r--r--indra/media_plugins/cef/windows_volume_catcher.cpp1
-rw-r--r--indra/media_plugins/example/CMakeLists.txt8
-rw-r--r--indra/media_plugins/gstreamer010/CMakeLists.txt46
-rw-r--r--indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms.cpp167
-rw-r--r--indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms.h74
-rw-r--r--indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms_raw.inc51
-rw-r--r--indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms_rawv.inc5
-rw-r--r--indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h55
-rw-r--r--indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp526
-rw-r--r--indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h105
-rw-r--r--indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp1266
-rw-r--r--indra/media_plugins/gstreamer10/CMakeLists.txt41
-rw-r--r--indra/media_plugins/gstreamer10/llmediaimplgstreamer.h (renamed from indra/media_plugins/gstreamer010/llmediaimplgstreamer.h)0
-rw-r--r--indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc71
-rw-r--r--indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp958
-rw-r--r--indra/media_plugins/libvlc/CMakeLists.txt7
-rw-r--r--indra/newview/CMakeLists.txt1
-rw-r--r--indra/newview/VIEWER_VERSION.txt2
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/materialF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl2
-rw-r--r--indra/newview/character/avatar_lad.xml46
-rw-r--r--indra/newview/featuretable_mac.txt14
-rw-r--r--indra/newview/gltfscenemanager.cpp59
-rwxr-xr-xindra/newview/linux_tools/wrapper.sh46
-rw-r--r--indra/newview/llagent.cpp54
-rw-r--r--indra/newview/llagent.h4
-rw-r--r--indra/newview/llagentcamera.cpp4
-rw-r--r--indra/newview/llaisapi.cpp2
-rw-r--r--indra/newview/llappviewer.cpp63
-rw-r--r--indra/newview/llappviewer.h6
-rw-r--r--indra/newview/llappviewerlinux.cpp344
-rw-r--r--indra/newview/llappviewerlinux.h28
-rw-r--r--indra/newview/llappviewerlinux_api.h143
-rw-r--r--indra/newview/llappviewerlinux_api.xml14
-rw-r--r--indra/newview/llappviewerlinux_api_dbus.cpp126
-rw-r--r--indra/newview/llappviewerlinux_api_dbus.h44
-rw-r--r--indra/newview/llappviewerlinux_api_dbus_syms_raw.inc9
-rw-r--r--indra/newview/llappviewerwin32.cpp36
-rw-r--r--indra/newview/llbox.cpp25
-rw-r--r--indra/newview/llchatmsgbox.cpp10
-rw-r--r--indra/newview/llconversationloglist.cpp1
-rw-r--r--indra/newview/llconversationview.cpp2
-rw-r--r--indra/newview/lldirpicker.cpp51
-rw-r--r--indra/newview/lldirpicker.h2
-rw-r--r--indra/newview/lldynamictexture.cpp54
-rw-r--r--indra/newview/llenvironment.cpp105
-rw-r--r--indra/newview/llexpandabletextbox.cpp8
-rw-r--r--indra/newview/llface.cpp94
-rw-r--r--indra/newview/llface.h13
-rw-r--r--indra/newview/llfeaturemanager.cpp44
-rw-r--r--indra/newview/llfilepicker.h31
-rw-r--r--indra/newview/llfloaterbuyland.cpp25
-rw-r--r--indra/newview/llfloaterbuyland.h2
-rw-r--r--indra/newview/llfloaterbvhpreview.cpp7
-rw-r--r--indra/newview/llfloatercreatelandmark.cpp14
-rw-r--r--indra/newview/llfloatercreatelandmark.h3
-rw-r--r--indra/newview/llfloateremojipicker.cpp60
-rw-r--r--indra/newview/llfloateremojipicker.h1
-rw-r--r--indra/newview/llfloatergltfasseteditor.cpp8
-rw-r--r--indra/newview/llfloaterimagepreview.cpp14
-rw-r--r--indra/newview/llfloaterland.cpp10
-rw-r--r--indra/newview/llfloaterland.h2
-rw-r--r--indra/newview/llfloatermodelpreview.cpp15
-rw-r--r--indra/newview/llfloaterperformance.cpp12
-rw-r--r--indra/newview/llfloaterperformance.h2
-rw-r--r--indra/newview/llfloaterpreference.cpp44
-rw-r--r--indra/newview/llfloaterpreference.h4
-rw-r--r--indra/newview/llfloaterpreferencesgraphicsadvanced.cpp2
-rw-r--r--indra/newview/llfloaterpreferencesgraphicsadvanced.h1
-rw-r--r--indra/newview/llfloaterregioninfo.cpp11
-rw-r--r--indra/newview/llfloaterregioninfo.h1
-rw-r--r--indra/newview/llfloatersnapshot.cpp3
-rw-r--r--indra/newview/llglsandbox.cpp163
-rw-r--r--indra/newview/llgltfmaterialpreviewmgr.cpp2
-rw-r--r--indra/newview/llhttpretrypolicy.cpp5
-rw-r--r--indra/newview/llhudeffectblob.cpp11
-rw-r--r--indra/newview/llhudicon.cpp7
-rw-r--r--indra/newview/llhudnametag.cpp14
-rw-r--r--indra/newview/llhudrender.cpp1
-rw-r--r--indra/newview/llimprocessing.cpp2
-rw-r--r--indra/newview/llimview.cpp2
-rw-r--r--indra/newview/llinventorybridge.cpp22
-rw-r--r--indra/newview/llinventorybridge.h5
-rw-r--r--indra/newview/llinventoryfilter.cpp6
-rw-r--r--indra/newview/llinventoryfilter.h2
-rw-r--r--indra/newview/llinventorymodel.cpp3
-rw-r--r--indra/newview/llinventorymodelbackgroundfetch.cpp17
-rw-r--r--indra/newview/llinventorypanel.cpp2
-rw-r--r--indra/newview/lljoystickbutton.cpp28
-rw-r--r--indra/newview/llmanip.cpp3
-rw-r--r--indra/newview/llmanipscale.cpp35
-rw-r--r--indra/newview/llmediactrl.cpp14
-rw-r--r--indra/newview/llmeshrepository.cpp143
-rw-r--r--indra/newview/llmeshrepository.h23
-rw-r--r--indra/newview/llmodelpreview.cpp150
-rw-r--r--indra/newview/llnetmap.cpp18
-rw-r--r--indra/newview/lloutfitslist.cpp4
-rw-r--r--indra/newview/llpanelemojicomplete.cpp3
-rw-r--r--indra/newview/llpanelface.cpp1
-rw-r--r--indra/newview/llpanelface.h5
-rw-r--r--indra/newview/llpanelgroupbulk.cpp32
-rw-r--r--indra/newview/llpanelgroupbulkban.cpp33
-rw-r--r--indra/newview/llpanelgroupbulkimpl.h3
-rw-r--r--indra/newview/llpanelmaininventory.cpp248
-rw-r--r--indra/newview/llpanelplaceprofile.cpp5
-rw-r--r--indra/newview/llpanelplaceprofile.h2
-rw-r--r--indra/newview/llpanelprofilepicks.cpp42
-rw-r--r--indra/newview/llpanelprofilepicks.h10
-rw-r--r--indra/newview/llphysicsshapebuilderutil.cpp53
-rw-r--r--indra/newview/llphysicsshapebuilderutil.h2
-rw-r--r--indra/newview/llsecapi.h2
-rw-r--r--indra/newview/llsettingsvo.cpp79
-rw-r--r--indra/newview/llsettingsvo.h10
-rw-r--r--indra/newview/llskinningutil.cpp43
-rw-r--r--indra/newview/llsnapshotlivepreview.cpp64
-rw-r--r--indra/newview/lltoastalertpanel.h10
-rw-r--r--indra/newview/lltoolmorph.cpp7
-rw-r--r--indra/newview/lltoolselect.cpp9
-rw-r--r--indra/newview/llviewerdisplay.cpp3
-rw-r--r--indra/newview/llviewerjointattachment.cpp8
-rw-r--r--indra/newview/llviewerjointmesh.cpp14
-rw-r--r--indra/newview/llviewermedia.cpp26
-rw-r--r--indra/newview/llviewermessage.cpp369
-rw-r--r--indra/newview/llviewerobject.cpp161
-rw-r--r--indra/newview/llviewerobject.h2
-rw-r--r--indra/newview/llviewerobjectlist.cpp5
-rwxr-xr-xindra/newview/llviewerregion.cpp1
-rw-r--r--indra/newview/llviewerstats.cpp2
-rw-r--r--indra/newview/llviewerstatsrecorder.cpp2
-rw-r--r--indra/newview/llviewertexteditor.cpp10
-rw-r--r--indra/newview/llviewertexturelist.cpp2
-rw-r--r--indra/newview/llviewerwindow.cpp44
-rw-r--r--indra/newview/llvoavatar.cpp153
-rw-r--r--indra/newview/llvoavatar.h2
-rw-r--r--indra/newview/llvograss.cpp1
-rw-r--r--indra/newview/llvoicevivox.cpp1
-rw-r--r--indra/newview/llvoicewebrtc.cpp23
-rw-r--r--indra/newview/llvopartgroup.cpp58
-rw-r--r--indra/newview/llvosurfacepatch.cpp1
-rw-r--r--indra/newview/llvovolume.cpp35
-rw-r--r--indra/newview/llvovolume.h1
-rw-r--r--indra/newview/llwindebug.h2
-rwxr-xr-xindra/newview/llworldmapview.cpp25
-rw-r--r--indra/newview/llxmlrpctransaction.cpp2
-rw-r--r--indra/newview/pipeline.cpp28
-rw-r--r--indra/newview/pipeline.h5
-rw-r--r--indra/newview/skins/default/xui/da/language_settings.xml1
-rw-r--r--indra/newview/skins/default/xui/de/language_settings.xml1
-rw-r--r--indra/newview/skins/default/xui/en/floater_emoji_picker.xml1
-rw-r--r--indra/newview/skins/default/xui/en/floater_fast_timers.xml2
-rw-r--r--indra/newview/skins/default/xui/en/floater_gltf_asset_editor.xml8
-rw-r--r--indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml2
-rw-r--r--indra/newview/skins/default/xui/en/floater_world_map.xml3
-rw-r--r--indra/newview/skins/default/xui/en/language_settings.xml1
-rw-r--r--indra/newview/skins/default/xui/en/menu_viewer.xml10
-rw-r--r--indra/newview/skins/default/xui/en/mime_types_linux.xml70
-rw-r--r--indra/newview/skins/default/xui/en/panel_group_roles.xml1179
-rw-r--r--indra/newview/skins/default/xui/en/panel_login_first.xml1
-rw-r--r--indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml40
-rw-r--r--indra/newview/skins/default/xui/en/panel_profile_pick.xml20
-rw-r--r--indra/newview/skins/default/xui/en/panel_region_environment.xml9
-rw-r--r--indra/newview/skins/default/xui/es/language_settings.xml1
-rw-r--r--indra/newview/skins/default/xui/fr/language_settings.xml1
-rw-r--r--indra/newview/skins/default/xui/it/language_settings.xml1
-rw-r--r--indra/newview/skins/default/xui/ja/language_settings.xml3
-rw-r--r--indra/newview/skins/default/xui/pl/language_settings.xml1
-rw-r--r--indra/newview/skins/default/xui/pt/language_settings.xml1
-rw-r--r--indra/newview/tests/lldateutil_test.cpp4
-rwxr-xr-xindra/newview/viewer_manifest.py223
-rw-r--r--indra/test/test.cpp70
-rw-r--r--scripts/perf/profile_cmp.py5
323 files changed, 9693 insertions, 7805 deletions
diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index 9ac24be468..0000000000
--- a/.editorconfig
+++ /dev/null
@@ -1,14 +0,0 @@
-root = true
-
-[*]
-charset = utf-8
-indent_size = 4
-indent_style = space
-insert_final_newline = true
-trim_trailing_whitespace = true
-
-[Makefile]
-indent_style = tab
-
-[*.{yml,yaml}]
-indent_size = 2
diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
index 0851d20be0..c68131402b 100644
--- a/.git-blame-ignore-revs
+++ b/.git-blame-ignore-revs
@@ -5,7 +5,11 @@
a0b3021bdcf76859054fda8e30abb3ed47749e83
8444cd9562a6a7b755fcb075864e205122354192
863c541ce0b2e3e1e566cc88423d3e87aaedb6ca
+743a1a6d8eabf069d95777c96e5b657cb8702593
+4a00da1ada89af6f313cee30f5177634b0b180a9
# Wrong line endings
1b67dd855c41f5a0cda7ec2a68d98071986ca703
6cc7dd09d5e69cf57e6de7fb568a0ad2693f9c9a
e2e37cced861b98de8c1a7c9c0d3a50d2d90e433
+# multiple problems
+5370a6d323e14d7b4e32a3f41ef78f7744e361c5
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 2cb94c9c90..1804da749f 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -18,6 +18,10 @@ jobs:
env:
# Build with a tag like "Second_Life#abcdef0" to generate a release page
# (used for builds we are planning to deploy).
+ # Even though inputs.release_run is specified with type boolean, which
+ # correctly presents a checkbox, its *value* is a GH workflow string
+ # 'true' or 'false'. If you simply test github.event.inputs.release_run,
+ # it always evaluates as true because it's a non-empty string either way.
# When you want to use a string variable as a workflow YAML boolean, it's
# important to ensure it's the empty string when false. If you omit || '',
# its value when false is "false", which is interpreted as true.
@@ -44,6 +48,9 @@ jobs:
matrix:
runner: [windows-large, macos-12-xl]
configuration: ${{ fromJSON(needs.setup.outputs.configurations) }}
+ include:
+ - runner: linux-large
+ configuration: ReleaseOS
runs-on: ${{ matrix.runner }}
outputs:
viewer_channel: ${{ steps.build.outputs.viewer_channel }}
@@ -120,6 +127,21 @@ jobs:
${{ runner.os }}-64-${{ matrix.configuration }}-
${{ runner.os }}-64-
+ - name: Install Linux dependencies
+ if: runner.os == 'Linux'
+ run: |
+ sudo apt update
+ sudo apt install -y \
+ libpulse-dev libunwind-dev \
+ libgl1-mesa-dev libglu1-mesa-dev libxinerama-dev \
+ libxcursor-dev libxfixes-dev libgstreamer1.0-dev \
+ libgstreamer-plugins-base1.0-dev ninja-build libxft-dev \
+ llvm mold libpipewire-0.3-dev
+
+ - name: Install windows dependencies
+ if: runner.os == 'Windows'
+ run: choco install nsis-unicode
+
- name: Determine source branch
id: which-branch
uses: secondlife/viewer-build-util/which-branch@v2
@@ -241,6 +263,13 @@ jobs:
fi
export PYTHON_COMMAND_NATIVE="$(native_path "$PYTHON_COMMAND")"
+ # Compile with clang, link with mold on linux.
+ if [[ "$RUNNER_OS" == "Linux" ]]; then
+ export CC=clang
+ export CXX=clang++
+ export CMAKE_OPTIONS='-DLINK_WITH_MOLD=ON'
+ fi
+
./build.sh
# Each artifact is downloaded as a distinct .zip file. Multiple jobs
@@ -269,6 +298,7 @@ jobs:
path: |
${{ steps.build.outputs.viewer_app }}
+
# The other upload of nontrivial size is the symbol file. Use a distinct
# artifact for that too.
- name: Upload symbol file
@@ -431,6 +461,10 @@ jobs:
with:
pattern: "*-metadata"
+ - uses: actions/download-artifact@v4
+ with:
+ pattern: "LinuxOS-app"
+
- name: Rename metadata
run: |
cp Windows-metadata/autobuild-package.xml Windows-autobuild-package.xml
@@ -451,7 +485,7 @@ jobs:
Build ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
${{ needs.build.outputs.viewer_channel }}
${{ needs.build.outputs.viewer_version }}
- ${{ needs.build.outputs.relnotes }}
+ ${{ needs.setvar.outputs.relnotes }}
prerelease: true
generate_release_notes: true
target_commitish: ${{ github.sha }}
diff --git a/.gitignore b/.gitignore
index 3b3666af84..c4accf37b5 100755
--- a/.gitignore
+++ b/.gitignore
@@ -26,7 +26,6 @@ debian/files
debian/secondlife-appearance-utility*
debian/secondlife-viewer*
indra/.distcc
-indra/cmake/*
indra/out/*
indra/packages/*
diff --git a/autobuild.xml b/autobuild.xml
index d53de1fb42..f0f96f025a 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -7,7 +7,7 @@
<string>autobuild</string>
<key>installables</key>
<map>
- <key>SDL</key>
+ <key>SDL2</key>
<map>
<key>platforms</key>
<map>
@@ -16,9 +16,11 @@
<key>archive</key>
<map>
<key>hash</key>
- <string>7ea2df03bfc35c06acf23dd9e734adac</string>
+ <string>6bbad9b30ee93749e4701313c537d5bac0850e2b</string>
+ <key>hash_algorithm</key>
+ <string>sha1</string>
<key>url</key>
- <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/1103/2554/SDL-1.2.15-linux64-501092.tar.bz2</string>
+ <string>https://github.com/secondlife/3p-sdl2/releases/download/v2.30.6-r1/SDL2-2.30.6-linux64-10323260130.tar.zst</string>
</map>
<key>name</key>
<string>linux64</string>
@@ -27,16 +29,46 @@
<key>license</key>
<string>lgpl</string>
<key>license_file</key>
- <string>LICENSES/SDL.txt</string>
+ <string>LICENSES/SDL2.txt</string>
<key>copyright</key>
- <string>Copyright (C) 1997-2012 Sam Lantinga</string>
+ <string>Copyright (C) 1997-2022 Sam Lantinga (slouken@libsdl.org)</string>
<key>version</key>
- <string>1.2.15</string>
+ <string>2.28.0</string>
<key>name</key>
- <string>SDL</string>
+ <string>SDL2</string>
<key>description</key>
<string>Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.</string>
</map>
+ <key>fltk</key>
+ <map>
+ <key>platforms</key>
+ <map>
+ <key>linux64</key>
+ <map>
+ <key>archive</key>
+ <map>
+ <key>hash</key>
+ <string>691fef2ddd57d7b6c26e87fc82d9ace3f54e078c</string>
+ <key>hash_algorithm</key>
+ <string>sha1</string>
+ <key>url</key>
+ <string>https://github.com/secondlife/3p-fltk/releases/download/v1.3.9-r1/fltk-1.3.9.8556992788-linux64-8556992788.tar.zst</string>
+ </map>
+ <key>name</key>
+ <string>linux</string>
+ </map>
+ </map>
+ <key>license</key>
+ <string>LGPL/fltk</string>
+ <key>license_file</key>
+ <string>LICENSES/fltk.txt</string>
+ <key>copyright</key>
+ <string>Copyright (C) fltk project</string>
+ <key>version</key>
+ <string>1.3.5</string>
+ <key>name</key>
+ <string>fltk</string>
+ </map>
<key>apr_suite</key>
<map>
<key>platforms</key>
@@ -284,12 +316,14 @@
<key>archive</key>
<map>
<key>hash</key>
- <string>77c53daf558f51aec6e9f4bd9e930a103630ee7d</string>
+ <string>aea0bed0f953a9371b9091f09230b41597f891f7</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
- <string>https://github.com/secondlife/3p-cubemap_to_eqr_js/releases/download/v1.1.0-d7afe27/cubemaptoequirectangular-1.1.0-linux64-d7afe27.tar.zst</string>
+ <string>https://github.com/secondlife/3p-cubemap_to_eqr_js/releases/download/v1.1.0-cb8785a/cubemaptoequirectangular-1.1.0-linux64-cb8785a.tar.zst</string>
</map>
+ <key>name</key>
+ <string>linux64</string>
</map>
<key>windows64</key>
<map>
@@ -817,34 +851,6 @@
<key>name</key>
<string>gstreamer</string>
</map>
- <key>gtk-atk-pango-glib</key>
- <map>
- <key>platforms</key>
- <map>
- <key>linux64</key>
- <map>
- <key>archive</key>
- <map>
- <key>hash</key>
- <string>de7bba8fd2275a11b077b124413065d0</string>
- <key>url</key>
- <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/p64_3p-gtk-atk-pango-glib/rev/314220/arch/Linux/installer/gtk_atk_pango_glib-0.1-linux64-314220.tar.bz2</string>
- </map>
- <key>name</key>
- <string>linux64</string>
- </map>
- </map>
- <key>license</key>
- <string>lgpl</string>
- <key>license_file</key>
- <string>LICENSES/gtk-atk-pango-glib.txt</string>
- <key>copyright</key>
- <string>Copyright (various, see sources)</string>
- <key>version</key>
- <string>0.1</string>
- <key>name</key>
- <string>gtk-atk-pango-glib</string>
- </map>
<key>havok-source</key>
<map>
<key>platforms</key>
@@ -869,10 +875,14 @@
<map>
<key>archive</key>
<map>
+ <key>creds</key>
+ <string>github</string>
<key>hash</key>
- <string>00d0333936a67059a43a6ec8ac38d564</string>
+ <string>ebfb82b6143874e7938b9d1e8a70d0a2e28aa818</string>
+ <key>hash_algorithm</key>
+ <string>sha1</string>
<key>url</key>
- <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/748/1563/havok_source-2012.1-2-linux64-500739.tar.bz2</string>
+ <string>https://api.github.com/repos/secondlife/3p-havok-source/releases/assets/108912599</string>
</map>
<key>name</key>
<string>linux64</string>
@@ -930,12 +940,14 @@
<key>archive</key>
<map>
<key>hash</key>
- <string>35d6a617444fde9c8a5e998ef29dc43b95747637</string>
+ <string>23daab838f4b8f92e5dc1a2f6c568cb7b0cb43b7</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
- <string>https://github.com/secondlife/3p-jpeg_encoder_js/releases/download/v1.0-9165e47/jpegencoderbasic-1.0-linux64-9165e47.tar.zst</string>
+ <string>https://github.com/secondlife/3p-jpeg_encoder_js/releases/download/v1.0-790015a/jpegencoderbasic-1.0-linux64-790015a.tar.zst</string>
</map>
+ <key>name</key>
+ <string>linux64</string>
</map>
<key>windows64</key>
<map>
@@ -1077,22 +1089,6 @@
<key>name</key>
<string>windows64</string>
</map>
- <key>linux</key>
- <map>
- <key>archive</key>
- <map>
- <key>creds</key>
- <string>github</string>
- <key>hash</key>
- <string>711b82f9f588d3a125af7dcd8c81f93d9c343a7d</string>
- <key>hash_algorithm</key>
- <string>sha1</string>
- <key>url</key>
- <string>https://api.github.com/repos/secondlife/3p-kdu/releases/assets/136774121</string>
- </map>
- <key>name</key>
- <string>linux</string>
- </map>
</map>
<key>license</key>
<string>Kakadu</string>
@@ -1696,33 +1692,33 @@
<key>name</key>
<string>darwin64</string>
</map>
- <key>windows64</key>
+ <key>linux64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
- <string>024ce689a6f13e66d0c7e431ac34071434e2365a</string>
+ <string>c947107c0aca46e94e22f66328a3cbbd01d99b36</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
- <string>https://github.com/secondlife/3p-meshoptimizer/releases/download/v210-r2/meshoptimizer-210.0.0-r2-windows64-10341021290.tar.zst</string>
+ <string>https://github.com/secondlife/3p-meshoptimizer/releases/download/v210-r2/meshoptimizer-210.0.0-r2-linux64-10341021290.tar.zst</string>
</map>
<key>name</key>
- <string>windows64</string>
+ <string>linux64</string>
</map>
- <key>linux64</key>
+ <key>windows64</key>
<map>
<key>archive</key>
<map>
<key>hash</key>
- <string>c947107c0aca46e94e22f66328a3cbbd01d99b36</string>
+ <string>024ce689a6f13e66d0c7e431ac34071434e2365a</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
- <string>https://github.com/secondlife/3p-meshoptimizer/releases/download/v210-r2/meshoptimizer-210.0.0-r2-linux64-10341021290.tar.zst</string>
+ <string>https://github.com/secondlife/3p-meshoptimizer/releases/download/v210-r2/meshoptimizer-210.0.0-r2-windows64-10341021290.tar.zst</string>
</map>
<key>name</key>
- <string>linux64</string>
+ <string>windows64</string>
</map>
</map>
<key>license</key>
@@ -2077,6 +2073,23 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
</map>
<key>open-libndofdev</key>
<map>
+ <key>platforms</key>
+ <map>
+ <key>linux64</key>
+ <map>
+ <key>archive</key>
+ <map>
+ <key>hash</key>
+ <string>da16445129cc82d23d01709a912c99fd74388395</string>
+ <key>hash_algorithm</key>
+ <string>sha1</string>
+ <key>url</key>
+ <string>https://github.com/secondlife/3p-open-libndofdev/releases/download/v1.14-r3/open_libndofdev-0.14.10326946482-linux64-10326946482.tar.zst</string>
+ </map>
+ <key>name</key>
+ <string>linux64</string>
+ </map>
+ </map>
<key>license</key>
<string>BSD</string>
<key>license_file</key>
@@ -2084,7 +2097,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>copyright</key>
<string>Copyright (c) 2008, Jan Ciger (jan.ciger (at) gmail.com)</string>
<key>version</key>
- <string>0.3</string>
+ <string>0.14.8730039102</string>
<key>name</key>
<string>open-libndofdev</string>
<key>description</key>
@@ -2413,12 +2426,14 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>archive</key>
<map>
<key>hash</key>
- <string>9de1295b157c9913c28be81ff933c73493ecc132</string>
+ <string>982c0fa427458082ea9e3cb9603904210732b64e</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
- <string>https://github.com/secondlife/3p-three_js/releases/download/v0.132.2-b8f6746/threejs-0.132.2-linux64-b8f6746.tar.zst</string>
+ <string>https://github.com/secondlife/3p-three_js/releases/download/v0.132.2-5da28d9/threejs-0.132.2-common-8454371083.tar.zst</string>
</map>
+ <key>name</key>
+ <string>linux64</string>
</map>
<key>windows64</key>
<map>
@@ -3215,6 +3230,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<string>-G</string>
<string>Ninja</string>
<string>-DLL_TESTS=Off</string>
+ <string>-DUSE_OPENAL=On</string>
</array>
</map>
<key>build</key>
diff --git a/build.sh b/build.sh
index dd85fde7d6..edd0c5a6d9 100755
--- a/build.sh
+++ b/build.sh
@@ -45,7 +45,7 @@ build_dir_Darwin()
build_dir_Linux()
{
- echo build-linux-i686
+ echo build-linux-x86_64
}
build_dir_CYGWIN()
@@ -163,6 +163,22 @@ pre_build()
fi
fi
+ if [[ "$arch" == "Linux" ]]
+ then
+ # RELEASE_CRASH_REPORTING is tuned on unconditionaly, this is fine but not for Linux as of now (due to missing breakpad/crashpad support)
+ RELEASE_CRASH_REPORTING=OFF
+
+ # Builds turn on HAVOK even when config is ReleaseOS.
+ # This needs AUTOBUILD_GITHUB_TOKEN to be set in the environment. But this is not set for PRs apparently.
+ # Still this seemlingy works on Windows and Mac, why not on the Linux runner? Mystery to be solved elsewhere.
+
+
+ if [[ "$variant" == "ReleaseOS" ]]
+ then
+ HAVOK=OFF
+ fi
+ fi
+
if [ "${RELEASE_CRASH_REPORTING:-}" != "OFF" ]
then
case "$arch" in
@@ -185,9 +201,17 @@ pre_build()
# honor autobuild_configure_parameters same as sling-buildscripts
eval_autobuild_configure_parameters=$(eval $(echo echo $autobuild_configure_parameters))
+ # We build the viewer on Linux, but we haven't committed to support the
+ # Linux viewer. As of 2024-05-30, Linux build-time test infrastructure is
+ # not in place, so don't even bother running tests on Linux.
+ if [[ "$RUNNER_OS" == "Linux" ]]
+ then LL_TESTS=OFF
+ else LL_TESTS=ON
+ fi
+
"$autobuild" configure --quiet -c $variant \
${eval_autobuild_configure_parameters:---} \
- -DLL_TESTS:BOOL=ON \
+ -DLL_TESTS:BOOL=$LL_TESTS \
-DPACKAGE:BOOL=ON \
-DHAVOK:BOOL="$HAVOK" \
-DRELEASE_CRASH_REPORTING:BOOL="$RELEASE_CRASH_REPORTING" \
@@ -196,6 +220,7 @@ pre_build()
-DVIEWER_CHANNEL:STRING="${viewer_channel}" \
-DGRID:STRING="\"$viewer_grid\"" \
-DTEMPLATE_VERIFIER_OPTIONS:STRING="$template_verifier_options" $template_verifier_master_url \
+ $CMAKE_OPTIONS \
"${SIGNING[@]}" \
|| fatal "$variant configuration failed"
@@ -517,15 +542,6 @@ then
fi
fi
-# Some of the uploads takes a long time to finish in the codeticket backend,
-# causing the next codeticket upload attempt to fail.
-# Inserting this after each potentially large upload may prevent those errors.
-# JJ is making changes to Codeticket that we hope will eliminate this failure, then this can be removed
-wait_for_codeticket()
-{
- sleep $(( 60 * 6 ))
-}
-
# check status and upload results to S3
if $succeeded
then
diff --git a/indra/cmake/00-Common.cmake b/indra/cmake/00-Common.cmake
index 5087c308ee..5cb25368d2 100644
--- a/indra/cmake/00-Common.cmake
+++ b/indra/cmake/00-Common.cmake
@@ -15,6 +15,7 @@
include_guard()
include(Variables)
+include(Linker)
# We go to some trouble to set LL_BUILD to the set of relevant compiler flags.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} $ENV{LL_BUILD}")
@@ -68,9 +69,12 @@ if (WINDOWS)
/NODEFAULTLIB:LIBCMT
/IGNORE:4099)
- add_definitions(
- -DNOMINMAX
-# /DDOM_DYNAMIC # For shared library colladadom
+ add_compile_definitions(
+ WIN32_LEAN_AND_MEAN
+ NOMINMAX
+# DOM_DYNAMIC # For shared library colladadom
+ _CRT_SECURE_NO_WARNINGS # Allow use of sprintf etc
+ _WINSOCK_DEPRECATED_NO_WARNINGS # Disable deprecated WinSock API warnings
)
add_compile_options(
/Zo
@@ -106,56 +110,91 @@ if (WINDOWS)
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
-
- # Allow use of sprintf etc
- add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
endif (WINDOWS)
-
if (LINUX)
- set(CMAKE_SKIP_RPATH TRUE)
-
- # EXTERNAL_TOS
- # force this platform to accept TOS via external browser
+ set( CMAKE_BUILD_WITH_INSTALL_RPATH TRUE )
+ set( CMAKE_INSTALL_RPATH $ORIGIN $ORIGIN/../lib )
+ set(CMAKE_EXE_LINKER_FLAGS "-Wl,--exclude-libs,ALL")
+
+ find_program(CCACHE_EXE ccache)
+ if(CCACHE_EXE AND NOT DISABLE_CCACHE)
+ set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXE} )
+ set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXE} )
+ endif()
- # LL_IGNORE_SIGCHLD
- # don't catch SIGCHLD in our base application class for the viewer - some of
- # our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The
- # viewer doesn't need to catch SIGCHLD anyway.
+ # LL_IGNORE_SIGCHLD
+ # don't catch SIGCHLD in our base application class for the viewer - some of
+ # our 3rd party libs may need their *own* SIGCHLD handler to work. Sigh! The
+ # viewer doesn't need to catch SIGCHLD anyway.
add_compile_definitions(
_REENTRANT
- _FORTIFY_SOURCE=2
- EXTERNAL_TOS
APPID=secondlife
LL_IGNORE_SIGCHLD
)
+
+ if( ENABLE_ASAN )
+ add_compile_options(-U_FORTIFY_SOURCE
+ -fsanitize=address
+ --param asan-stack=0
+ )
+ add_link_options(-fsanitize=address)
+ else()
+ add_compile_definitions( _FORTIFY_SOURCE=2 )
+ endif()
+
add_compile_options(
- -fexceptions
- -fno-math-errno
- -fno-strict-aliasing
- -fsigned-char
- -msse2
- -mfpmath=sse
- -pthread
- -Wno-parentheses
- -Wno-deprecated
- -fvisibility=hidden
+ -fexceptions
+ -fno-math-errno
+ -fno-strict-aliasing
+ -fsigned-char
+ -msse2
+ -mfpmath=sse
+ -pthread
+ -fvisibility=hidden
+ )
+
+ set(GCC_CLANG_COMPATIBLE_WARNINGS
+ -Wno-parentheses
+ -Wno-deprecated
+ -Wno-c++20-compat
+ -Wno-pessimizing-move
+ )
+
+ set(CLANG_WARNINGS
+ ${GCC_CLANG_COMPATIBLE_WARNINGS}
+ # Put clang specific warning configuration here
)
- if (ADDRESS_SIZE EQUAL 32)
- add_compile_options(-march=pentium4)
- endif (ADDRESS_SIZE EQUAL 32)
+ set(GCC_WARNINGS
+ ${GCC_CLANG_COMPATIBLE_WARNINGS}
+ )
+
+ add_link_options(
+ -Wl,--no-keep-memory
+ -Wl,--build-id
+ -Wl,--no-undefined
+ )
+ if (NOT GCC_DISABLE_FATAL_WARNINGS)
+ add_compile_options( -Werror )
+ endif (NOT GCC_DISABLE_FATAL_WARNINGS)
# this stops us requiring a really recent glibc at runtime
add_compile_options(-fno-stack-protector)
- # linking can be very memory-hungry, especially the final viewer link
- set(CMAKE_CXX_LINK_FLAGS "-Wl,--no-keep-memory")
- set(CMAKE_CXX_FLAGS_DEBUG "-fno-inline ${CMAKE_CXX_FLAGS_DEBUG}")
+ if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ # ND: clang is a bit more picky than GCC, the latter seems to auto include -lstdc++ and -lm. The former not so and thus fails to link
+ add_link_options(
+ -lstdc++
+ -lm
+ )
+ add_compile_options(${CLANG_WARNINGS})
+ else()
+ add_compile_options(${GCC_WARNINGS})
+ endif()
endif (LINUX)
-
if (DARWIN)
# Warnings should be fatal -- thanks, Nicky Perian, for spotting reversed default
set(CLANG_DISABLE_FATAL_WARNINGS OFF)
@@ -177,15 +216,9 @@ if (DARWIN)
# required for clang-15/xcode-15 since our boost package still uses deprecated std::unary_function/binary_function
# see https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#C++-Standard-Library
add_compile_definitions(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION)
-endif (DARWIN)
-if (LINUX OR DARWIN)
set(GCC_WARNINGS -Wall -Wno-sign-compare -Wno-trigraphs)
- if (NOT GCC_DISABLE_FATAL_WARNINGS)
- list(APPEND GCC_WARNINGS -Werror)
- endif (NOT GCC_DISABLE_FATAL_WARNINGS)
-
list(APPEND GCC_WARNINGS -Wno-reorder -Wno-non-virtual-dtor )
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13)
@@ -194,7 +227,4 @@ if (LINUX OR DARWIN)
add_compile_options(${GCC_WARNINGS})
add_compile_options(-m${ADDRESS_SIZE})
-endif (LINUX OR DARWIN)
-
-
-
+endif ()
diff --git a/indra/cmake/Audio.cmake b/indra/cmake/Audio.cmake
index 8c82749cab..6de33af314 100644
--- a/indra/cmake/Audio.cmake
+++ b/indra/cmake/Audio.cmake
@@ -21,11 +21,6 @@ if (WINDOWS)
debug ${ARCH_PREBUILT_DIRS_DEBUG}/libvorbis.lib
)
else (WINDOWS)
- target_link_libraries(ll::vorbis INTERFACE
- ${ARCH_PREBUILT_DIRS_RELEASE}/libogg.a
- ${ARCH_PREBUILT_DIRS_RELEASE}/libvorbisenc.a
- ${ARCH_PREBUILT_DIRS_RELEASE}/libvorbisfile.a
- ${ARCH_PREBUILT_DIRS_RELEASE}/libvorbis.a
- )
+ target_link_libraries(ll::vorbis INTERFACE vorbisfile vorbis ogg vorbisenc )
endif (WINDOWS)
diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake
index 8c5b946753..57f44dae59 100644
--- a/indra/cmake/Boost.cmake
+++ b/indra/cmake/Boost.cmake
@@ -28,12 +28,11 @@ if (WINDOWS)
libboost_url-mt${addrsfx})
elseif (LINUX)
target_link_libraries( ll::boost INTERFACE
- boost_context-mt${addrsfx}
boost_fiber-mt${addrsfx}
+ boost_context-mt${addrsfx}
boost_filesystem-mt${addrsfx}
boost_program_options-mt${addrsfx}
boost_regex-mt${addrsfx}
- boost_signals-mt${addrsfx}
boost_system-mt${addrsfx}
boost_thread-mt${addrsfx}
boost_url-mt${addrsfx})
diff --git a/indra/cmake/CEFPlugin.cmake b/indra/cmake/CEFPlugin.cmake
index 9b77becf29..555d2aebbf 100644
--- a/indra/cmake/CEFPlugin.cmake
+++ b/indra/cmake/CEFPlugin.cmake
@@ -33,4 +33,9 @@ elseif (DARWIN)
)
elseif (LINUX)
+ target_link_libraries( ll::cef INTERFACE
+ libdullahan.a
+ cef
+ cef_dll_wrapper.a
+ )
endif (WINDOWS)
diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index 04ce9f1333..16da388e61 100644
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -15,7 +15,6 @@ set(cmake_SOURCE_FILES
CEFPlugin.cmake
CEFPlugin.cmake
CMakeCopyIfDifferent.cmake
- ConfigurePkgConfig.cmake
CURL.cmake
Copy3rdPartyLibs.cmake
DBusGlib.cmake
diff --git a/indra/cmake/ConfigurePkgConfig.cmake b/indra/cmake/ConfigurePkgConfig.cmake
deleted file mode 100644
index 9e798d663b..0000000000
--- a/indra/cmake/ConfigurePkgConfig.cmake
+++ /dev/null
@@ -1,74 +0,0 @@
-# -*- cmake -*-
-
-SET(DEBUG_PKG_CONFIG "YES")
-
-# Don't change this if manually set by user.
-IF("$ENV{PKG_CONFIG_LIBDIR}" STREQUAL "")
-
- # Guess at architecture-specific system library paths.
- if (ADDRESS_SIZE EQUAL 32)
- SET(PKG_CONFIG_NO_MULTI_GUESS /usr/lib32 /usr/lib)
- SET(PKG_CONFIG_NO_MULTI_LOCAL_GUESS /usr/local/lib32 /usr/local/lib)
- SET(PKG_CONFIG_MULTI_GUESS /usr/lib/i386-linux-gnu)
- SET(PKG_CONFIG_MULTI_LOCAL_GUESS /usr/local/lib/i386-linux-gnu)
- else (ADDRESS_SIZE EQUAL 32)
- SET(PKG_CONFIG_NO_MULTI_GUESS /usr/lib64 /usr/lib)
- SET(PKG_CONFIG_NO_MULTI_LOCAL_GUESS /usr/local/lib64 /usr/local/lib)
- SET(PKG_CONFIG_MULTI_GUESS /usr/local/lib/x86_64-linux-gnu)
- SET(PKG_CONFIG_MULTI_LOCAL_GUESS /usr/local/lib/x86_64-linux-gnu)
- endif (ADDRESS_SIZE EQUAL 32)
-
- # Use DPKG architecture, if available.
- IF (${DPKG_ARCH})
- SET(PKG_CONFIG_MULTI_GUESS /usr/lib/${DPKG_ARCH})
- SET(PKG_CONFIG_MULTI_LOCAL_GUESS /usrlocal/lib/${DPKG_ARCH})
- ENDIF (${DPKG_ARCH})
-
- # Explicitly include anything listed in PKG_CONFIG_PATH
- string(REPLACE ":" ";" PKG_CONFIG_PATH_LIST "$ENV{PKG_CONFIG_PATH}")
- FOREACH(PKG_CONFIG_DIR ${PKG_CONFIG_PATH_LIST})
- SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:${PKG_CONFIG_DIR}/pkgconfig")
- ENDFOREACH(PKG_CONFIG_DIR)
-
- # Look for valid pkgconfig directories.
- FIND_PATH(PKG_CONFIG_ENV pkgconfig ENV LD_LIBRARY_PATH)
- FIND_PATH(PKG_CONFIG_MULTI pkgconfig HINT ${PKG_CONFIG_MULTI_GUESS})
- FIND_PATH(PKG_CONFIG_MULTI_LOCAL pkgconfig HINT ${PKG_CONFIG_MULTI_LOCAL_GUESS})
- FIND_PATH(PKG_CONFIG_NO_MULTI pkgconfig HINT ${PKG_CONFIG_NO_MULTI_GUESS})
- FIND_PATH(PKG_CONFIG_NO_MULTI_LOCAL pkgconfig HINT ${PKG_CONFIG_NO_MULTI_LOCAL_GUESS})
-
- # Add anything we found to our list.
- IF(NOT PKG_CONFIG_ENV STREQUAL PKG_CONFIG_ENV-NOTFOUND)
- SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:${PKG_CONFIG_ENV}/pkgconfig")
- ENDIF(NOT PKG_CONFIG_ENV STREQUAL PKG_CONFIG_ENV-NOTFOUND)
-
- IF(NOT PKG_CONFIG_MULTI STREQUAL PKG_CONFIG_MULTI-NOTFOUND)
- SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:${PKG_CONFIG_MULTI}/pkgconfig")
- ENDIF(NOT PKG_CONFIG_MULTI STREQUAL PKG_CONFIG_MULTI-NOTFOUND)
-
- IF(NOT PKG_CONFIG_MULTI_LOCAL STREQUAL PKG_CONFIG_MULTI_LOCAL-NOTFOUND)
- SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:${PKG_CONFIG_MULTI_LOCAL}/pkgconfig")
- ENDIF(NOT PKG_CONFIG_MULTI_LOCAL STREQUAL PKG_CONFIG_MULTI_LOCAL-NOTFOUND)
-
- IF(NOT PKG_CONFIG_NO_MULTI STREQUAL PKG_CONFIG_NO_MULTI-NOTFOUND)
- SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:${PKG_CONFIG_NO_MULTI}/pkgconfig")
- ENDIF(NOT PKG_CONFIG_NO_MULTI STREQUAL PKG_CONFIG_NO_MULTI-NOTFOUND)
-
- IF(NOT PKG_CONFIG_NO_MULTI_LOCAL STREQUAL PKG_CONFIG_NO_MULTI_LOCAL-NOTFOUND)
- SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:${PKG_CONFIG_NO_MULTI_LOCAL}/pkgconfig")
- ENDIF(NOT PKG_CONFIG_NO_MULTI_LOCAL STREQUAL PKG_CONFIG_NO_MULTI_LOCAL-NOTFOUND)
-
- # Also add some non-architecture specific package locations.
- SET(VALID_PKG_LIBDIRS "${VALID_PKG_LIBDIRS}:/usr/share/pkgconfig:/usr/local/share/pkgconfig")
-
- # Remove first unwanted ':'
- string(SUBSTRING ${VALID_PKG_LIBDIRS} 1 -1 VALID_PKG_LIBDIRS)
-
- # Set PKG_CONFIG_LIBDIR environment.
- SET(ENV{PKG_CONFIG_LIBDIR} ${VALID_PKG_LIBDIRS})
-ENDIF("$ENV{PKG_CONFIG_LIBDIR}" STREQUAL "")
-
-IF(DEBUG_PKG_CONFIG)
- MESSAGE(STATUS "Using PKG_CONFIG_LIBDIR=$ENV{PKG_CONFIG_LIBDIR}")
-ENDIF(DEBUG_PKG_CONFIG)
-
diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake
index 6ac00fd131..ced012426f 100644
--- a/indra/cmake/Copy3rdPartyLibs.cmake
+++ b/indra/cmake/Copy3rdPartyLibs.cmake
@@ -214,16 +214,8 @@ elseif(LINUX)
if( USE_AUTOBUILD_3P )
list( APPEND release_files
- libatk-1.0.so
- libfreetype.so.6.6.2
- libfreetype.so.6
- libopenjp2.so
- libuuid.so.16
- libuuid.so.16.0.22
- libfontconfig.so.1.8.0
- libfontconfig.so.1
- libgmodule-2.0.so
- libgobject-2.0.so
+ libapr-1.so.0
+ libaprutil-1.so.0
)
if(LLCOMMON_LINK_SHARED)
diff --git a/indra/cmake/FindPipeWire.cmake b/indra/cmake/FindPipeWire.cmake
new file mode 100644
index 0000000000..868acf5ec1
--- /dev/null
+++ b/indra/cmake/FindPipeWire.cmake
@@ -0,0 +1,100 @@
+# cmake-format: off
+# .rst: FindPipeWire
+# -------
+#
+# Try to find PipeWire on a Unix system.
+#
+# This will define the following variables:
+#
+# ``PIPEWIRE_FOUND`` True if (the requested version of) PipeWire is available
+# ``PIPEWIRE_VERSION`` The version of PipeWire ``PIPEWIRE_LIBRARIES`` This can
+# be passed to target_link_libraries() instead of the ``PipeWire::PipeWire``
+# target ``PIPEWIRE_INCLUDE_DIRS`` This should be passed to
+# target_include_directories() if the target is not used for linking
+# ``PIPEWIRE_COMPILE_FLAGS`` This should be passed to target_compile_options()
+# if the target is not used for linking
+#
+# If ``PIPEWIRE_FOUND`` is TRUE, it will also define the following imported
+# target:
+#
+# ``PipeWire::PipeWire`` The PipeWire library
+#
+# In general we recommend using the imported target, as it is easier to use.
+# Bear in mind, however, that if the target is in the link interface of an
+# exported library, it must be made available by the package config file.
+
+# =============================================================================
+# Copyright 2014 Alex Merry <alex.merry@kde.org> Copyright 2014 Martin Gräßlin
+# <mgraesslin@kde.org> Copyright 2018-2020 Jan Grulich <jgrulich@redhat.com>
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the copyright notice, this list
+# of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the copyright notice, this
+# list of conditions and the following disclaimer in the documentation and/or
+# other materials provided with the distribution.
+# 3. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+# =============================================================================
+# cmake-format: on
+
+# Use pkg-config to get the directories and then use these values in the FIND_PATH() and FIND_LIBRARY() calls
+find_package(PkgConfig QUIET)
+
+pkg_search_module(PKG_PIPEWIRE QUIET libpipewire-0.3)
+pkg_search_module(PKG_SPA QUIET libspa-0.2)
+
+set(PIPEWIRE_COMPILE_FLAGS "${PKG_PIPEWIRE_CFLAGS}" "${PKG_SPA_CFLAGS}")
+set(PIPEWIRE_VERSION "${PKG_PIPEWIRE_VERSION}")
+
+find_path(
+ PIPEWIRE_INCLUDE_DIRS
+ NAMES pipewire/pipewire.h
+ HINTS ${PKG_PIPEWIRE_INCLUDE_DIRS} ${PKG_PIPEWIRE_INCLUDE_DIRS}/pipewire-0.3)
+
+find_path(
+ SPA_INCLUDE_DIRS
+ NAMES spa/param/props.h
+ HINTS ${PKG_SPA_INCLUDE_DIRS} ${PKG_SPA_INCLUDE_DIRS}/spa-0.2)
+
+find_library(
+ PIPEWIRE_LIBRARIES
+ NAMES pipewire-0.3
+ HINTS ${PKG_PIPEWIRE_LIBRARY_DIRS})
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(
+ PipeWire
+ FOUND_VAR PIPEWIRE_FOUND
+ REQUIRED_VARS PIPEWIRE_LIBRARIES PIPEWIRE_INCLUDE_DIRS SPA_INCLUDE_DIRS
+ VERSION_VAR PIPEWIRE_VERSION)
+
+if(PIPEWIRE_FOUND AND NOT TARGET PipeWire::PipeWire)
+ add_library(PipeWire::PipeWire UNKNOWN IMPORTED)
+ set_target_properties(
+ PipeWire::PipeWire
+ PROPERTIES IMPORTED_LOCATION "${PIPEWIRE_LIBRARIES}"
+ INTERFACE_COMPILE_OPTIONS "${PIPEWIRE_COMPILE_FLAGS}"
+ INTERFACE_INCLUDE_DIRECTORIES "${PIPEWIRE_INCLUDE_DIRS};${SPA_INCLUDE_DIRS}")
+endif()
+
+mark_as_advanced(PIPEWIRE_LIBRARIES PIPEWIRE_INCLUDE_DIRS)
+
+include(FeatureSummary)
+set_package_properties(
+ PipeWire PROPERTIES
+ URL "https://www.pipewire.org"
+ DESCRIPTION "PipeWire - multimedia processing")
diff --git a/indra/cmake/FreeType.cmake b/indra/cmake/FreeType.cmake
index 563491556d..47ac96f793 100644
--- a/indra/cmake/FreeType.cmake
+++ b/indra/cmake/FreeType.cmake
@@ -11,6 +11,8 @@ target_include_directories( ll::freetype SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/
if (WINDOWS)
target_link_libraries( ll::freetype INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/freetype.lib)
+elseif( LINUX )
+ target_link_libraries( ll::freetype INTERFACE ${LIBS_PREBUILT_DIR}/lib/release/libfreetype.a ${LIBS_PREBUILT_DIR}/lib/release/libpng16.a)
else()
target_link_libraries( ll::freetype INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libfreetype.a)
endif()
diff --git a/indra/cmake/GLIB.cmake b/indra/cmake/GLIB.cmake
new file mode 100644
index 0000000000..f52cbb7f87
--- /dev/null
+++ b/indra/cmake/GLIB.cmake
@@ -0,0 +1,22 @@
+include_guard()
+
+include(Prebuilt)
+
+add_library( ll::glib INTERFACE IMPORTED )
+add_library( ll::glib_headers INTERFACE IMPORTED )
+add_library( ll::gio INTERFACE IMPORTED )
+
+if( LINUX )
+ find_package(PkgConfig REQUIRED)
+ pkg_search_module(GLIB REQUIRED glib-2.0)
+ pkg_search_module(GIO REQUIRED gio-2.0)
+
+ target_include_directories( ll::glib SYSTEM INTERFACE ${GLIB_INCLUDE_DIRS} )
+ target_link_libraries( ll::glib INTERFACE ${GLIB_LDFLAGS} )
+ target_compile_definitions( ll::glib INTERFACE -DLL_GLIB=1)
+
+ target_include_directories( ll::glib_headers SYSTEM INTERFACE ${GLIB_INCLUDE_DIRS} )
+ target_compile_definitions( ll::glib_headers INTERFACE -DLL_GLIB=1)
+
+ target_link_libraries( ll::gio INTERFACE ${GIO_LDFLAGS} )
+endif()
diff --git a/indra/cmake/GStreamer10Plugin.cmake b/indra/cmake/GStreamer10Plugin.cmake
new file mode 100644
index 0000000000..da2e33d04d
--- /dev/null
+++ b/indra/cmake/GStreamer10Plugin.cmake
@@ -0,0 +1,27 @@
+# -*- cmake -*-
+
+include_guard()
+
+include(Prebuilt)
+include(GLIB)
+
+add_library( ll::gstreamer10 INTERFACE IMPORTED )
+
+if (LINUX)
+ include(FindPkgConfig)
+
+ pkg_check_modules(GSTREAMER10 REQUIRED gstreamer-1.0)
+ pkg_check_modules(GSTREAMER10_PLUGINS_BASE REQUIRED gstreamer-plugins-base-1.0)
+
+ target_include_directories( ll::gstreamer10 SYSTEM INTERFACE ${GSTREAMER10_INCLUDE_DIRS})
+ target_link_libraries( ll::gstreamer10 INTERFACE ll::glib_headers)
+
+endif ()
+
+if (GSTREAMER10_FOUND AND GSTREAMER10_PLUGINS_BASE_FOUND)
+ set(GSTREAMER10 ON CACHE BOOL "Build with GStreamer-1.0 streaming media support.")
+endif (GSTREAMER10_FOUND AND GSTREAMER10_PLUGINS_BASE_FOUND)
+
+if (GSTREAMER10)
+ add_definitions(-DLL_GSTREAMER10_ENABLED=1)
+endif (GSTREAMER10)
diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake
index 6408f1200c..5d96a4398f 100644
--- a/indra/cmake/LLAddBuildTest.cmake
+++ b/indra/cmake/LLAddBuildTest.cmake
@@ -1,4 +1,11 @@
# -*- cmake -*-
+
+include_guard()
+
+if( NOT LL_TESTS )
+ return()
+endif()
+
include(00-Common)
include(LLTestCommand)
include(bugsplat)
diff --git a/indra/cmake/LLWindow.cmake b/indra/cmake/LLWindow.cmake
index 2e1b601b79..23f4115aeb 100644
--- a/indra/cmake/LLWindow.cmake
+++ b/indra/cmake/LLWindow.cmake
@@ -10,13 +10,11 @@ add_library( ll::SDL INTERFACE IMPORTED )
if (LINUX)
#Must come first as use_system_binary can exit this file early
- target_compile_definitions( ll::SDL INTERFACE LL_SDL=1)
+ target_compile_definitions( ll::SDL INTERFACE LL_SDL_VERSION=2 LL_SDL)
- use_system_binary(SDL)
- use_prebuilt_binary(SDL)
+ #find_package(SDL2 REQUIRED)
+ #target_link_libraries( ll::SDL INTERFACE SDL2::SDL2 SDL2::SDL2main X11)
- target_include_directories( ll::SDL SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include)
- target_link_libraries( ll::SDL INTERFACE SDL directfb fusion direct X11)
+ use_prebuilt_binary(SDL2)
+ target_link_libraries( ll::SDL INTERFACE SDL2 X11)
endif (LINUX)
-
-
diff --git a/indra/cmake/Linker.cmake b/indra/cmake/Linker.cmake
new file mode 100644
index 0000000000..8016842192
--- /dev/null
+++ b/indra/cmake/Linker.cmake
@@ -0,0 +1,11 @@
+include_guard(GLOBAL)
+
+if( LINK_WITH_MOLD )
+ find_program(MOLD_BIN mold)
+ if(MOLD_BIN)
+ message(STATUS "Mold linker found: ${MOLD_BIN}. Enabling mold as active linker.")
+ add_link_options("-fuse-ld=${MOLD_BIN}")
+ else()
+ message(STATUS "Mold linker not found. Using default linker.")
+ endif()
+endif()
diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake
index 1d757abeff..2bdf0a8aa1 100644
--- a/indra/cmake/Linking.cmake
+++ b/indra/cmake/Linking.cmake
@@ -7,6 +7,7 @@ set(ARCH_PREBUILT_DIRS ${AUTOBUILD_INSTALL_DIR}/lib)
set(ARCH_PREBUILT_DIRS_PLUGINS ${AUTOBUILD_INSTALL_DIR}/plugins)
set(ARCH_PREBUILT_DIRS_RELEASE ${AUTOBUILD_INSTALL_DIR}/lib/release)
set(ARCH_PREBUILT_DIRS_DEBUG ${AUTOBUILD_INSTALL_DIR}/lib/debug)
+
if (WINDOWS OR DARWIN )
# Kludge for older cmake versions, 3.20+ is needed to use a genex in add_custom_command( OUTPUT <var> ... )
# Using this will work okay-ish, as Debug is not supported anyway. But for property multi config and also
diff --git a/indra/cmake/Meshoptimizer.cmake b/indra/cmake/Meshoptimizer.cmake
index fd144d2b97..6983a5895a 100644
--- a/indra/cmake/Meshoptimizer.cmake
+++ b/indra/cmake/Meshoptimizer.cmake
@@ -12,7 +12,7 @@ use_prebuilt_binary(meshoptimizer)
if (WINDOWS)
target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer.lib)
elseif (LINUX)
- target_link_libraries( ll::meshoptimizer INTERFACE meshoptimizer.o)
+ target_link_libraries( ll::meshoptimizer INTERFACE libmeshoptimizer.a)
elseif (DARWIN)
target_link_libraries( ll::meshoptimizer INTERFACE libmeshoptimizer.a)
endif (WINDOWS)
diff --git a/indra/cmake/NDOF.cmake b/indra/cmake/NDOF.cmake
index b88fbccf2a..db9c8b1780 100644
--- a/indra/cmake/NDOF.cmake
+++ b/indra/cmake/NDOF.cmake
@@ -19,6 +19,6 @@ if (NDOF)
target_link_libraries( ll::ndof INTERFACE ndofdev)
endif (WINDOWS)
target_compile_definitions( ll::ndof INTERFACE LIB_NDOF=1)
+else()
+ add_compile_options(-ULIB_NDOF)
endif (NDOF)
-
-
diff --git a/indra/cmake/Tracy.cmake b/indra/cmake/Tracy.cmake
index d54a32fdc2..9eee9eb57f 100644
--- a/indra/cmake/Tracy.cmake
+++ b/indra/cmake/Tracy.cmake
@@ -6,12 +6,17 @@ add_library( ll::tracy INTERFACE IMPORTED )
# default Tracy profiling on for test builds, but off for all others
string(TOLOWER ${VIEWER_CHANNEL} channel_lower)
-if(WINDOWS AND channel_lower MATCHES "^second life test")
+if(channel_lower MATCHES "^second life test")
option(USE_TRACY "Use Tracy profiler." ON)
else()
option(USE_TRACY "Use Tracy profiler." OFF)
endif()
+if (LINUX)
+ # tracy currently conflicts with llcommon/stdtypes.h on linux. keep it disabled until we fix it
+ set(USE_TRACY OFF)
+endif(LINUX)
+
if (USE_TRACY)
option(USE_TRACY_ON_DEMAND "Use on-demand Tracy profiling." ON)
option(USE_TRACY_LOCAL_ONLY "Disallow remote Tracy profiling." OFF)
@@ -31,6 +36,11 @@ if (USE_TRACY)
target_compile_definitions(ll::tracy INTERFACE -DTRACY_NO_BROADCAST=1 -DTRACY_ONLY_LOCALHOST=1)
endif ()
+ # GHA runners don't always provide invariant TSC support, but always build with LL_TESTS enabled
+ if (DARWIN AND LL_TESTS)
+ target_compile_definitions(ll::tracy INTERFACE -DTRACY_TIMER_FALLBACK=1)
+ endif ()
+
# See: indra/llcommon/llprofiler.h
add_compile_definitions(LL_PROFILER_CONFIGURATION=3)
endif (USE_TRACY)
diff --git a/indra/cmake/UI.cmake b/indra/cmake/UI.cmake
index 8f135676d6..0df62808e7 100644
--- a/indra/cmake/UI.cmake
+++ b/indra/cmake/UI.cmake
@@ -1,35 +1,33 @@
# -*- cmake -*-
include(Prebuilt)
include(FreeType)
+include(GLIB)
add_library( ll::uilibraries INTERFACE IMPORTED )
if (LINUX)
- target_compile_definitions(ll::uilibraries INTERFACE LL_GTK=1 LL_X11=1 )
+ use_prebuilt_binary(fltk)
+ target_compile_definitions(ll::uilibraries INTERFACE LL_FLTK=1 LL_X11=1 )
if( USE_CONAN )
- target_link_libraries( ll::uilibraries INTERFACE CONAN_PKG::gtk )
return()
endif()
- use_prebuilt_binary(gtk-atk-pango-glib)
target_link_libraries( ll::uilibraries INTERFACE
- atk-1.0
- gdk-x11-2.0
- gdk_pixbuf-2.0
- Xinerama
- glib-2.0
- gmodule-2.0
- gobject-2.0
- gthread-2.0
- gtk-x11-2.0
- pango-1.0
- pangoft2-1.0
- pangox-1.0
- pangoxft-1.0
+ fltk
+ Xrender
+ Xcursor
+ Xfixes
+ Xext
+ Xft
Xinerama
+ ll::fontconfig
ll::freetype
- )
+ ll::SDL
+ ll::glib
+ ll::gio
+ )
+
endif (LINUX)
if( WINDOWS )
target_link_libraries( ll::uilibraries INTERFACE
@@ -51,4 +49,3 @@ endif()
target_include_directories( ll::uilibraries SYSTEM INTERFACE
${LIBS_PREBUILT_DIR}/include
)
-
diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index 5b3aeb8b7f..5dfad25577 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -127,8 +127,6 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/${DPKG_ARCH} /usr/local/lib/${DPKG_ARCH} ${CMAKE_SYSTEM_LIBRARY_PATH})
endif (DPKG_RESULT EQUAL 0)
- include(ConfigurePkgConfig)
-
if (INSTALL_PROPRIETARY)
# Only turn on headless if we can find osmesa libraries.
include(FindPkgConfig)
diff --git a/indra/cmake/ViewerMiscLibs.cmake b/indra/cmake/ViewerMiscLibs.cmake
index cae68fbc11..2cb11994fc 100644
--- a/indra/cmake/ViewerMiscLibs.cmake
+++ b/indra/cmake/ViewerMiscLibs.cmake
@@ -2,14 +2,10 @@
include(Prebuilt)
if (LINUX)
- #use_prebuilt_binary(libuuid)
add_library( ll::fontconfig INTERFACE IMPORTED )
- if( NOT USE_CONAN )
- use_prebuilt_binary(fontconfig)
- else()
- target_link_libraries( ll::fontconfig INTERFACE CONAN_PKG::fontconfig )
- endif()
+ find_package(Fontconfig REQUIRED)
+ target_link_libraries( ll::fontconfig INTERFACE Fontconfig::Fontconfig )
endif (LINUX)
if( NOT USE_CONAN )
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py
index 38de9c7cf1..b5fdccc9ba 100755
--- a/indra/lib/python/indra/util/llmanifest.py
+++ b/indra/lib/python/indra/util/llmanifest.py
@@ -309,7 +309,7 @@ def main(extra=[]):
class LLManifestRegistry(type):
def __init__(cls, name, bases, dct):
super(LLManifestRegistry, cls).__init__(name, bases, dct)
- match = re.match("(\w+)Manifest", name)
+ match = re.match(r"(\w+)Manifest", name)
if match:
cls.manifests[match.group(1).lower()] = cls
diff --git a/indra/linux_crash_logger/llcrashloggerlinux.cpp b/indra/linux_crash_logger/llcrashloggerlinux.cpp
index 9b40de741e..7992f59b36 100644
--- a/indra/linux_crash_logger/llcrashloggerlinux.cpp
+++ b/indra/linux_crash_logger/llcrashloggerlinux.cpp
@@ -38,9 +38,6 @@
#include "lldir.h"
#include "llsdserialize.h"
-#if LL_GTK
-# include "gtk/gtk.h"
-#endif // LL_GTK
#define MAX_LOADSTRING 100
@@ -54,52 +51,9 @@ static const char dialog_text[] =
static const char dialog_title[] =
"Second Life Crash Logger";
-#if LL_GTK
-static void response_callback (GtkDialog *dialog,
- gint arg1,
- gpointer user_data)
-{
- gint *response = (gint*)user_data;
- *response = arg1;
- gtk_widget_destroy(GTK_WIDGET(dialog));
- gtk_main_quit();
-}
-#endif // LL_GTK
-
static BOOL do_ask_dialog(void)
{
-#if LL_GTK
- gtk_disable_setlocale();
- if (!gtk_init_check(NULL, NULL)) {
- LL_INFOS() << "Could not initialize GTK for 'ask to send crash report' dialog; not sending report." << LL_ENDL;
- return FALSE;
- }
-
- GtkWidget *win = NULL;
- GtkDialogFlags flags = GTK_DIALOG_MODAL;
- GtkMessageType messagetype = GTK_MESSAGE_QUESTION;
- GtkButtonsType buttons = GTK_BUTTONS_YES_NO;
- gint response = GTK_RESPONSE_NONE;
-
- win = gtk_message_dialog_new(NULL,
- flags, messagetype, buttons,
- "%s", dialog_text);
- gtk_window_set_type_hint(GTK_WINDOW(win),
- GDK_WINDOW_TYPE_HINT_DIALOG);
- gtk_window_set_title(GTK_WINDOW(win), dialog_title);
- g_signal_connect (win,
- "response",
- G_CALLBACK (response_callback),
- &response);
- gtk_widget_show_all (win);
- gtk_main();
-
- return (GTK_RESPONSE_OK == response ||
- GTK_RESPONSE_YES == response ||
- GTK_RESPONSE_APPLY == response);
-#else
- return FALSE;
-#endif // LL_GTK
+ // Ask to send crash report. Yes/No dialog.
}
LLCrashLoggerLinux::LLCrashLoggerLinux(void)
diff --git a/indra/llappearance/llavatarappearancedefines.cpp b/indra/llappearance/llavatarappearancedefines.cpp
index 580e6433c5..5f98f2c8c1 100644
--- a/indra/llappearance/llavatarappearancedefines.cpp
+++ b/indra/llappearance/llavatarappearancedefines.cpp
@@ -28,8 +28,8 @@
#include "llavatarappearancedefines.h"
#include "indra_constants.h"
-const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 1024;
-const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 1024;
+const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 2048;
+const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 2048;
using namespace LLAvatarAppearanceDefines;
diff --git a/indra/llappearance/llpolymesh.cpp b/indra/llappearance/llpolymesh.cpp
index 97f9ca68b6..719381b4fc 100644
--- a/indra/llappearance/llpolymesh.cpp
+++ b/indra/llappearance/llpolymesh.cpp
@@ -981,7 +981,7 @@ void LLPolyMesh::initializeForMorph()
LLVector4a::memcpyNonAliased16((F32*) mScaledNormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices);
LLVector4a::memcpyNonAliased16((F32*) mBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices);
LLVector4a::memcpyNonAliased16((F32*) mScaledBinormals, (F32*) mSharedData->mBaseNormals, sizeof(LLVector4a) * mSharedData->mNumVertices);
- LLVector4a::memcpyNonAliased16((F32*) mTexCoords, (F32*) mSharedData->mTexCoords, sizeof(LLVector2) * (mSharedData->mNumVertices + mSharedData->mNumVertices%2));
+ memcpy((F32*) mTexCoords, (F32*) mSharedData->mTexCoords, sizeof(LLVector2) * (mSharedData->mNumVertices)); // allocated in LLPolyMeshSharedData::allocateVertexData
for (S32 i = 0; i < mSharedData->mNumVertices; ++i)
{
diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp
index a7e5292fed..ae038e09cc 100644
--- a/indra/llappearance/llwearable.cpp
+++ b/indra/llappearance/llwearable.cpp
@@ -645,9 +645,10 @@ void LLWearable::addVisualParam(LLVisualParam *param)
void LLWearable::setVisualParamWeight(S32 param_index, F32 value)
{
- if( is_in_map(mVisualParamIndexMap, param_index ) )
+ visual_param_index_map_t::iterator found = mVisualParamIndexMap.find(param_index);
+ if (found != mVisualParamIndexMap.end())
{
- LLVisualParam *wearable_param = mVisualParamIndexMap[param_index];
+ LLVisualParam *wearable_param = found->second;
wearable_param->setWeight(value);
}
else
@@ -658,9 +659,10 @@ void LLWearable::setVisualParamWeight(S32 param_index, F32 value)
F32 LLWearable::getVisualParamWeight(S32 param_index) const
{
- if( is_in_map(mVisualParamIndexMap, param_index ) )
+ visual_param_index_map_t::const_iterator found = mVisualParamIndexMap.find(param_index);
+ if(found != mVisualParamIndexMap.end())
{
- const LLVisualParam *wearable_param = mVisualParamIndexMap.find(param_index)->second;
+ const LLVisualParam *wearable_param = found->second;
return wearable_param->getWeight();
}
else
@@ -733,9 +735,9 @@ void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp)
if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) )
{
S32 param_id = param->getID();
+ // get weight from wearable and write back into character
F32 weight = getVisualParamWeight(param_id);
-
- avatarp->setVisualParamWeight( param_id, weight);
+ param->setWeight(weight);
}
}
}
diff --git a/indra/llappearance/llwearabledata.cpp b/indra/llappearance/llwearabledata.cpp
index 7598ed67f3..f3b76da224 100644
--- a/indra/llappearance/llwearabledata.cpp
+++ b/indra/llappearance/llwearabledata.cpp
@@ -286,43 +286,45 @@ const LLWearable* LLWearableData::getWearable(const LLWearableType::EType type,
LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type)
{
- U32 count = getWearableCount(type);
- if ( count == 0)
+ wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
+ if (wearable_iter == mWearableDatas.end())
{
return NULL;
}
+ const wearableentry_vec_t& wearable_vec = wearable_iter->second;
- return getWearable(type, count-1);
+ size_t size = wearable_vec.size();
+ if (size == 0)
+ {
+ return NULL;
+ }
+ return wearable_vec[size - 1];
}
const LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type) const
{
- U32 count = getWearableCount(type);
- if ( count == 0)
+ wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
+ if (wearable_iter == mWearableDatas.end())
{
return NULL;
}
+ const wearableentry_vec_t& wearable_vec = wearable_iter->second;
- return getWearable(type, count-1);
-}
-
-LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type)
-{
- if (getWearableCount(type) == 0)
+ size_t size = wearable_vec.size();
+ if (size == 0)
{
return NULL;
}
+ return wearable_vec[size - 1];
+}
+LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type)
+{
return getWearable(type, 0);
}
const LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type) const
{
- if (getWearableCount(type) == 0)
- {
- return NULL;
- }
-
return getWearable(type, 0);
}
diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt
index 9b99d86434..78bfaade55 100644
--- a/indra/llcommon/CMakeLists.txt
+++ b/indra/llcommon/CMakeLists.txt
@@ -252,7 +252,6 @@ set(llcommon_HEADER_FILES
lluriparser.h
lluuid.h
llwin32headers.h
- llwin32headerslean.h
llworkerthread.h
lockstatic.h
lua_function.h
diff --git a/indra/llcommon/always_return.h b/indra/llcommon/always_return.h
index a206471da5..a56a8b443e 100644
--- a/indra/llcommon/always_return.h
+++ b/indra/llcommon/always_return.h
@@ -14,6 +14,7 @@
#define LL_ALWAYS_RETURN_H
#include <type_traits> // std::enable_if, std::is_convertible
+#include <utility> // std::forward
namespace LL
{
@@ -79,6 +80,22 @@ namespace LL
DESIRED mDefault;
};
+ // specialize for AlwaysReturn<void>
+ template <>
+ struct AlwaysReturn<void>
+ {
+ public:
+ AlwaysReturn() {}
+
+ // callable returns a type not convertible to DESIRED, return default
+ template <typename CALLABLE, typename... ARGS>
+ void operator()(CALLABLE&& callable, ARGS&&... args)
+ {
+ // discard whatever callable(args) returns
+ std::forward<CALLABLE>(callable)(std::forward<ARGS>(args)...);
+ }
+ };
+
/**
* always_return<T>(some_function, some_args...) calls
* some_function(some_args...). It is guaranteed to return a value of type
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index eca611ad6c..c1dce97632 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -88,10 +88,6 @@ LLApp* LLApp::sApplication = NULL;
// and disables crashlogger
bool LLApp::sDisableCrashlogger = false;
-// Local flag for whether or not to do logging in signal handlers.
-//static
-bool LLApp::sLogInSignal = true;
-
// static
// Keeps track of application status
LLScalarCond<LLApp::EAppStatus> LLApp::sStatus{LLApp::APP_STATUS_STOPPED};
@@ -596,6 +592,10 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *)
// We do the somewhat sketchy operation of blocking in here until the error handler
// has gracefully stopped the app.
+ // FIXME(brad) - we are using this handler for asynchronous signals as well, so sLogInSignal is currently
+ // disabled for safety. we need to find a way to selectively reenable it when it is safe.
+ // see issue secondlife/viewer#2566
+
if (LLApp::sLogInSignal)
{
LL_INFOS() << "Signal handler - Got signal " << signum << " - " << apr_signal_description_get(signum) << LL_ENDL;
diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h
index d90ecdf661..3d18864b80 100644
--- a/indra/llcommon/llapp.h
+++ b/indra/llcommon/llapp.h
@@ -339,8 +339,12 @@ private:
friend void default_unix_signal_handler(int signum, siginfo_t *info, void *);
#endif
-public:
- static bool sLogInSignal;
+private:
+#ifdef LL_RELEASE_FOR_DOWNLOAD
+ static constexpr bool sLogInSignal = false;
+#else
+ static constexpr bool sLogInSignal = true;
+#endif
};
#endif // LL_LLAPP_H
diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h
index 00ff4d60b7..ff5c8c6a33 100644
--- a/indra/llcommon/llapr.h
+++ b/indra/llcommon/llapr.h
@@ -33,8 +33,9 @@
#include <sys/param.h> // Need PATH_MAX in APR headers...
#endif
+#include <memory>
#include <boost/noncopyable.hpp>
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include "apr_thread_proc.h"
#include "apr_getopt.h"
#include "apr_signal.h"
diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp
index 0b46802295..1ae5c87a00 100644
--- a/indra/llcommon/llcoros.cpp
+++ b/indra/llcommon/llcoros.cpp
@@ -137,7 +137,7 @@ LLCoros::LLCoros():
// Previously we used
// boost::context::guarded_stack_allocator::default_stacksize();
// empirically this is insufficient.
- mStackSize(1024*1024),
+ mStackSize(512*1024),
// mCurrent does NOT own the current CoroData instance -- it simply
// points to it. So initialize it with a no-op deleter.
mCurrent{ [](CoroData*){} }
@@ -178,7 +178,7 @@ void LLCoros::cleanupSingleton()
// don't use llcoro::suspend() because that module depends
// on this one
// This will yield current(main) thread and will let active
- // corutines run once
+ // coroutines run once
boost::this_fiber::yield();
}
printActiveCoroutines("after pumping");
@@ -309,55 +309,6 @@ std::string LLCoros::launch(const std::string& prefix, const callable_t& callabl
return name;
}
-namespace
-{
-
-#if LL_WINDOWS
-
-static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific
-
-U32 exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop)
-{
- if (code == STATUS_MSC_EXCEPTION)
- {
- // C++ exception, go on
- return EXCEPTION_CONTINUE_SEARCH;
- }
- else
- {
- // handle it
- return EXCEPTION_EXECUTE_HANDLER;
- }
-}
-
-void sehandle(const LLCoros::callable_t& callable)
-{
- __try
- {
- callable();
- }
- __except (exception_filter(GetExceptionCode(), GetExceptionInformation()))
- {
- // convert to C++ styled exception
- // Note: it might be better to use _se_set_translator
- // if you want exception to inherit full callstack
- char integer_string[512];
- sprintf(integer_string, "SEH, code: %lu\n", GetExceptionCode());
- throw std::exception(integer_string);
- }
-}
-
-#else // ! LL_WINDOWS
-
-inline void sehandle(const LLCoros::callable_t& callable)
-{
- callable();
-}
-
-#endif // ! LL_WINDOWS
-
-} // anonymous namespace
-
// Top-level wrapper around caller's coroutine callable.
// Normally we like to pass strings and such by const reference -- but in this
// case, we WANT to copy both the name and the callable to our local stack!
@@ -372,8 +323,7 @@ void LLCoros::toplevel(std::string name, callable_t callable)
// run the code the caller actually wants in the coroutine
try
{
- sehandle(callable);
- LL_DEBUGS("LLCoros") << "done " << name << LL_ENDL;
+ LL::seh::catcher(callable);
}
catch (const Stop& exc)
{
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index e6fe1eca75..90294acd55 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -112,7 +112,7 @@ namespace {
virtual void recordMessage(LLError::ELevel level,
const std::string& message) override
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_LOGGING;
int syslogPriority = LOG_CRIT;
switch (level) {
case LLError::LEVEL_DEBUG: syslogPriority = LOG_DEBUG; break;
diff --git a/indra/llcommon/llerror.h b/indra/llcommon/llerror.h
index 8a143ff30a..b17b9ff21e 100644
--- a/indra/llcommon/llerror.h
+++ b/indra/llcommon/llerror.h
@@ -95,6 +95,11 @@ const int LL_ERR_NOERR = 0;
#define LL_STATIC_ASSERT(func, msg) static_assert(func, msg)
#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) static_assert(false, msg)
#else
+#if LL_LINUX
+// We need access to raise and SIGSEGV
+#include <signal.h>
+#endif
+
#define LL_STATIC_ASSERT(func, msg) BOOST_STATIC_ASSERT(func)
#define LL_BAD_TEMPLATE_INSTANTIATION(type, msg) BOOST_STATIC_ASSERT(sizeof(type) != 0 && false);
#endif
@@ -408,12 +413,18 @@ typedef LLError::NoClassInfo _LL_CLASS_TO_LOG;
#define LL_NEWLINE '\n'
// Use this only in LL_ERRS or in a place that LL_ERRS may not be used
+
+#ifndef LL_LINUX
#define LLERROR_CRASH \
{ \
int* make_me_crash = (int*)0xDEADBEEFDEADBEEFUL; \
*make_me_crash = 0; \
exit(*make_me_crash); \
}
+#else
+// For Linux we just call raise and be done with it. No fighting the compiler to create a crashing code snippet.
+#define LLERROR_CRASH raise(SIGSEGV );
+#endif
#define LL_ENDL \
LLError::End(); \
diff --git a/indra/llcommon/llexception.cpp b/indra/llcommon/llexception.cpp
index c0154a569f..0a2f2ab607 100644
--- a/indra/llcommon/llexception.cpp
+++ b/indra/llcommon/llexception.cpp
@@ -15,6 +15,8 @@
#include "llexception.h"
// STL headers
// std headers
+#include <iomanip>
+#include <sstream>
#include <typeinfo>
// external library headers
#include <boost/exception/diagnostic_information.hpp>
@@ -29,7 +31,6 @@
// On Windows, header-only implementation causes macro collisions -- use
// prebuilt library
#define BOOST_STACKTRACE_LINK
-#include <excpt.h>
#endif // LL_WINDOWS
#include <boost/stacktrace.hpp>
@@ -94,25 +95,47 @@ void annotate_exception_(boost::exception& exc)
// For windows SEH exception handling we sometimes need a filter that will
// separate C++ exceptions from C SEH exceptions
-static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific
+static constexpr U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific
+static constexpr U32 STATUS_STACK_FULL = 0xC00000FD;
-U32 msc_exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop)
+void LL::seh::fill_stacktrace(std::string& stacktrace, U32 code)
{
- const auto stack = to_string(boost::stacktrace::stacktrace());
- LL_WARNS() << "SEH Exception handled (that probably shouldn't be): Code " << code
- << "\n Stack trace: \n"
- << stack << LL_ENDL;
+ // Sadly, despite its diagnostic importance, trying to capture a
+ // stacktrace when the stack is already blown only terminates us faster.
+ if (code == STATUS_STACK_FULL)
+ {
+ stacktrace = "(stack overflow, no traceback)";
+ }
+ else
+ {
+ stacktrace = to_string(boost::stacktrace::stacktrace());
+ }
+}
+U32 LL::seh::common_filter(U32 code, struct _EXCEPTION_POINTERS*)
+{
if (code == STATUS_MSC_EXCEPTION)
{
- // C++ exception, go on
+ // C++ exception, don't stop at this handler
return EXCEPTION_CONTINUE_SEARCH;
}
else
{
- // handle it
+ // This is a non-C++ exception, e.g. hardware check.
+ // Pass control into the handler block.
return EXCEPTION_EXECUTE_HANDLER;
}
}
+void LL::seh::rethrow(U32 code, const std::string& stacktrace)
+{
+ std::ostringstream out;
+ out << "Windows exception 0x" << std::hex << code;
+ if (! stacktrace.empty())
+ {
+ out << '\n' << stacktrace;
+ }
+ LLTHROW(Windows_SEH_exception(out.str()));
+}
+
#endif //LL_WINDOWS
diff --git a/indra/llcommon/llexception.h b/indra/llcommon/llexception.h
index 15dacd76fc..0c32a55409 100644
--- a/indra/llcommon/llexception.h
+++ b/indra/llcommon/llexception.h
@@ -12,11 +12,16 @@
#if ! defined(LL_LLEXCEPTION_H)
#define LL_LLEXCEPTION_H
+#include "always_return.h"
#include "stdtypes.h"
#include <stdexcept>
+#include <utility> // std::forward
#include <boost/exception/exception.hpp>
#include <boost/throw_exception.hpp>
#include <boost/current_function.hpp>
+#if LL_WINDOWS
+#include <excpt.h>
+#endif // LL_WINDOWS
// "Found someone who can comfort me
// But there are always exceptions..."
@@ -103,14 +108,115 @@ void crash_on_unhandled_exception_(const char*, int, const char*, const std::str
log_unhandled_exception_(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION, CONTEXT)
void log_unhandled_exception_(const char*, int, const char*, const std::string&);
+/*****************************************************************************
+* Structured Exception Handling
+*****************************************************************************/
+// this is used in platform-generic code -- define outside #if LL_WINDOWS
+struct Windows_SEH_exception: public LLException
+{
+ Windows_SEH_exception(const std::string& what): LLException(what) {}
+};
-#if LL_WINDOWS
+namespace LL
+{
+namespace seh
+{
+
+#if LL_WINDOWS //-------------------------------------------------------------
+
+void fill_stacktrace(std::string& stacktrace, U32 code);
+
+// wrapper around caller's U32 filter(U32 code, struct _EXCEPTION_POINTERS*)
+// filter function: capture a stacktrace, if possible, before forwarding the
+// call to the caller's filter() function
+template <typename FILTER>
+U32 filter_(std::string& stacktrace, FILTER&& filter,
+ U32 code, struct _EXCEPTION_POINTERS* exptrs)
+{
+ // By the time the handler gets control, the stack has been unwound,
+ // so report the stack trace now at filter() time.
+ fill_stacktrace(stacktrace, code);
+ return std::forward<FILTER>(filter)(code, exptrs);
+}
+
+template <typename TRYCODE, typename FILTER, typename HANDLER>
+auto catcher_inner(std::string& stacktrace,
+ TRYCODE&& trycode, FILTER&& filter, HANDLER&& handler)
+{
+ __try
+ {
+ return std::forward<TRYCODE>(trycode)();
+ }
+ __except (filter_(stacktrace,
+ std::forward<FILTER>(filter),
+ GetExceptionCode(), GetExceptionInformation()))
+ {
+ return always_return<decltype(trycode())>(
+ std::forward<HANDLER>(handler), GetExceptionCode(), stacktrace);
+ }
+}
+
+// triadic variant specifies try(), filter(U32, struct _EXCEPTION_POINTERS*),
+// handler(U32, const std::string& stacktrace)
+// stacktrace may or may not be available
+template <typename TRYCODE, typename FILTER, typename HANDLER>
+auto catcher(TRYCODE&& trycode, FILTER&& filter, HANDLER&& handler)
+{
+ // Construct and destroy this stacktrace string in the outer function
+ // because we can't do either in the function with __try/__except.
+ std::string stacktrace;
+ return catcher_inner(stacktrace,
+ std::forward<TRYCODE>(trycode),
+ std::forward<FILTER>(filter),
+ std::forward<HANDLER>(handler));
+}
+
+// common_filter() handles the typical case in which we want our handler
+// clause to handle only Structured Exceptions rather than explicitly-thrown
+// C++ exceptions
+U32 common_filter(U32 code, struct _EXCEPTION_POINTERS*);
+
+// dyadic variant specifies try(), handler(U32, stacktrace), assumes common_filter()
+template <typename TRYCODE, typename HANDLER>
+auto catcher(TRYCODE&& trycode, HANDLER&& handler)
+{
+ return catcher(std::forward<TRYCODE>(trycode),
+ common_filter,
+ std::forward<HANDLER>(handler));
+}
+
+[[noreturn]] void rethrow(U32 code, const std::string& stacktrace);
+
+// monadic variant specifies try(), assumes default filter and handler
+template <typename TRYCODE>
+auto catcher(TRYCODE&& trycode)
+{
+ return catcher(std::forward<TRYCODE>(trycode), rethrow);
+}
+
+#else // not LL_WINDOWS -----------------------------------------------------
+
+template <typename TRYCODE, typename FILTER, typename HANDLER>
+auto catcher(TRYCODE&& trycode, FILTER&&, HANDLER&&)
+{
+ return std::forward<TRYCODE>(trycode)();
+}
+
+template <typename TRYCODE, typename HANDLER>
+auto catcher(TRYCODE&& trycode, HANDLER&&)
+{
+ return std::forward<TRYCODE>(trycode)();
+}
+
+template <typename TRYCODE>
+auto catcher(TRYCODE&& trycode)
+{
+ return std::forward<TRYCODE>(trycode)();
+}
-// SEH exception filtering for use in __try __except
-// Separates C++ exceptions from C SEH exceptions
-// Todo: might be good idea to do some kind of seh_to_msc_wrapper(function, ARGS&&);
-U32 msc_exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop);
+#endif // not LL_WINDOWS -----------------------------------------------------
-#endif //LL_WINDOWS
+} // namespace LL::seh
+} // namespace LL
#endif /* ! defined(LL_LLEXCEPTION_H) */
diff --git a/indra/llcommon/llfile.cpp b/indra/llcommon/llfile.cpp
index ed94ef21ef..d0bc8f7652 100644
--- a/indra/llcommon/llfile.cpp
+++ b/indra/llcommon/llfile.cpp
@@ -34,7 +34,7 @@
#include "stringize.h"
#if LL_WINDOWS
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include <stdlib.h> // Windows errno
#include <vector>
#else
diff --git a/indra/llcommon/llmutex.h b/indra/llcommon/llmutex.h
index 6e8cf9643b..62943845a5 100644
--- a/indra/llcommon/llmutex.h
+++ b/indra/llcommon/llmutex.h
@@ -194,6 +194,18 @@ public:
mSharedMutex->unlock<SHARED>();
}
+ void lock()
+ {
+ if (mSharedMutex)
+ mSharedMutex->lock<SHARED>();
+ }
+
+ void unlock()
+ {
+ if (mSharedMutex)
+ mSharedMutex->unlock<SHARED>();
+ }
+
private:
LLSharedMutex* mSharedMutex;
};
diff --git a/indra/llcommon/llpreprocessor.h b/indra/llcommon/llpreprocessor.h
index a528cc7fd8..b499a9ce10 100644
--- a/indra/llcommon/llpreprocessor.h
+++ b/indra/llcommon/llpreprocessor.h
@@ -98,15 +98,6 @@
# define LL_THREAD_LOCAL __thread
#endif
-// Static linking with apr on windows needs to be declared.
-#if LL_WINDOWS && !LL_COMMON_LINK_SHARED
-#ifndef APR_DECLARE_STATIC
-#define APR_DECLARE_STATIC // For APR on Windows
-#endif
-#ifndef APU_DECLARE_STATIC
-#define APU_DECLARE_STATIC // For APR util on Windows
-#endif
-#endif
#if defined(LL_WINDOWS)
#define BOOST_REGEX_NO_LIB 1
@@ -119,13 +110,6 @@
// Deal with VC++ problems
#if LL_MSVC
-#ifndef _CRT_SECURE_NO_WARNINGS
-#define _CRT_SECURE_NO_WARNINGS // disable warnings for methods considered unsafe
-#endif
-#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
-#define _WINSOCK_DEPRECATED_NO_WARNINGS // disable deprecated WinSock API warnings
-#endif
-
// level 4 warnings that we need to disable:
#pragma warning (disable : 4251) // member needs to have dll-interface to be used by clients of class
#pragma warning (disable : 4275) // non dll-interface class used as base for dll-interface class
diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h
index 39ed29c1b4..cc2d6566fc 100644
--- a/indra/llcommon/llprocess.h
+++ b/indra/llcommon/llprocess.h
@@ -29,7 +29,6 @@
#include "llinitparam.h"
#include "llsdparam.h"
-#include "llwin32headerslean.h"
#include "llexception.h"
#include "apr_thread_proc.h"
#include <boost/ptr_container/ptr_vector.hpp>
@@ -38,7 +37,7 @@
#include <iosfwd> // std::ostream
#if LL_WINDOWS
-#include "llwin32headerslean.h" // for HANDLE
+#include "llwin32headers.h" // for HANDLE
#elif LL_LINUX
#if defined(Status)
#undef Status
diff --git a/indra/llcommon/llprocessor.cpp b/indra/llcommon/llprocessor.cpp
index 9d53b9be35..51b1b967f1 100644
--- a/indra/llcommon/llprocessor.cpp
+++ b/indra/llcommon/llprocessor.cpp
@@ -34,7 +34,7 @@
//#include <memory>
#if LL_WINDOWS
-# include "llwin32headerslean.h"
+# include "llwin32headers.h"
# define _interlockedbittestandset _renamed_interlockedbittestandset
# define _interlockedbittestandreset _renamed_interlockedbittestandreset
# include <intrin.h>
@@ -793,19 +793,55 @@ private:
};
#elif LL_LINUX
+
+// *NOTE:Mani - eww, macros! srry.
+#define LLPI_SET_INFO_STRING(llpi_id, cpuinfo_id) \
+ if (!cpuinfo[cpuinfo_id].empty()) \
+ { setInfo(llpi_id, cpuinfo[cpuinfo_id]);}
+
+#define LLPI_SET_INFO_INT(llpi_id, cpuinfo_id) \
+ {\
+ S32 result; \
+ if (!cpuinfo[cpuinfo_id].empty() \
+ && LLStringUtil::convertToS32(cpuinfo[cpuinfo_id], result)) \
+ { setInfo(llpi_id, result);} \
+ }
+
const char CPUINFO_FILE[] = "/proc/cpuinfo";
-class LLProcessorInfoLinuxImpl : public LLProcessorInfoImpl
-{
+class LLProcessorInfoLinuxImpl : public LLProcessorInfoImpl {
public:
- LLProcessorInfoLinuxImpl()
- {
+ LLProcessorInfoLinuxImpl() {
get_proc_cpuinfo();
}
virtual ~LLProcessorInfoLinuxImpl() {}
+
private:
+ F64 getCPUMaxMHZ()
+ {
+ // Nicky: We just look into cpu0. In theory we could iterate over all cores
+ // "/sys/devices/system/cpu/cpu*/cpufreq/cpuinfo_max_freq"
+ // But those should not fluctuate that much?
+ std::ifstream fIn { "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq" };
+
+ if( !fIn.is_open() )
+ return 0.0;
+
+ std::string strLine;
+ fIn >> strLine;
+ if( strLine.empty() )
+ return 0.0l;
+
+ F64 mhz {};
+ if( !LLStringUtil::convertToF64(strLine, mhz ) )
+ return 0.0;
+
+ mhz = mhz / 1000.0;
+ return mhz;
+ }
+
void get_proc_cpuinfo()
{
std::map< std::string, std::string > cpuinfo;
@@ -834,30 +870,23 @@ private:
std::string llinename(linename);
LLStringUtil::toLower(llinename);
std::string lineval( spacespot + 1, nlspot );
- cpuinfo[ llinename ] = lineval;
+ cpuinfo[ llinename ] = lineval;
}
fclose(cpuinfo_fp);
}
# if LL_X86
-// *NOTE:Mani - eww, macros! srry.
-#define LLPI_SET_INFO_STRING(llpi_id, cpuinfo_id) \
- if (!cpuinfo[cpuinfo_id].empty()) \
- { setInfo(llpi_id, cpuinfo[cpuinfo_id]);}
-
-#define LLPI_SET_INFO_INT(llpi_id, cpuinfo_id) \
- {\
- S32 result; \
- if (!cpuinfo[cpuinfo_id].empty() \
- && LLStringUtil::convertToS32(cpuinfo[cpuinfo_id], result)) \
- { setInfo(llpi_id, result);} \
+ F64 mhzFromSys = getCPUMaxMHZ();
+ F64 mhzFromProc {};
+ if( !LLStringUtil::convertToF64(cpuinfo["cpu mhz"], mhzFromProc ) )
+ mhzFromProc = 0.0;
+ if (mhzFromSys > 1.0 && mhzFromSys > mhzFromProc )
+ {
+ setInfo( eFrequency, mhzFromSys );
}
-
- F64 mhz;
- if (LLStringUtil::convertToF64(cpuinfo["cpu mhz"], mhz)
- && 200.0 < mhz && mhz < 10000.0)
+ else if ( 200.0 < mhzFromProc && mhzFromProc < 10000.0)
{
- setInfo(eFrequency,(F64)(mhz));
+ setInfo(eFrequency,(F64)(mhzFromProc));
}
LLPI_SET_INFO_STRING(eBrandName, "model name");
@@ -867,7 +896,7 @@ private:
LLPI_SET_INFO_INT(eModel, "model");
- S32 family;
+ S32 family{};
if (!cpuinfo["cpu family"].empty()
&& LLStringUtil::convertToS32(cpuinfo["cpu family"], family))
{
diff --git a/indra/llcommon/llrand.cpp b/indra/llcommon/llrand.cpp
index 2c51e6f07f..513613f543 100644
--- a/indra/llcommon/llrand.cpp
+++ b/indra/llcommon/llrand.cpp
@@ -58,9 +58,26 @@
* to restore uniform distribution.
*/
-// gRandomGenerator is a stateful static object, which is therefore not
+// pRandomGenerator is a stateful static object, which is therefore not
// inherently thread-safe.
-static thread_local LLRandLagFib2281 gRandomGenerator(LLUUID::getRandomSeed());
+//We use a pointer to not construct a huge object in the TLS space, sadly this is necessary
+// due to libcef.so on Linux being compiled with TLS model initial-exec (resulting in
+// FLAG STATIC_TLS, see readelf libcef.so). CEFs own TLS objects + LLRandLagFib2281 then will exhaust the
+// available TLS space, causing media failure.
+
+static thread_local std::unique_ptr< LLRandLagFib2281 > pRandomGenerator = nullptr;
+
+namespace {
+ F64 ll_internal_get_rand()
+ {
+ if( !pRandomGenerator )
+ {
+ pRandomGenerator.reset(new LLRandLagFib2281(LLUUID::getRandomSeed( ) ));
+ }
+
+ return(*pRandomGenerator)();
+ }
+}
// no default implementation, only specific F64 and F32 specializations
template <typename REAL>
@@ -73,7 +90,7 @@ inline F64 ll_internal_random<F64>()
// CPUs (or at least multi-threaded processes) seem to
// occasionally give an obviously incorrect random number -- like
// 5^15 or something. Sooooo, clamp it as described above.
- F64 rv{ gRandomGenerator() };
+ F64 rv{ ll_internal_get_rand() };
if(!((rv >= 0.0) && (rv < 1.0))) return fmod(rv, 1.0);
return rv;
}
@@ -85,7 +102,7 @@ inline F32 ll_internal_random<F32>()
// Per Monty, it's important to clamp using the correct fmodf() rather
// than expanding to F64 for fmod() and then truncating back to F32. Prior
// to this change, we were getting sporadic ll_frand() == 1.0 results.
- F32 rv{ narrow<F64>(gRandomGenerator()) };
+ F32 rv{ narrow<F64>(ll_internal_get_rand()) };
if(!((rv >= 0.0f) && (rv < 1.0f))) return fmodf(rv, 1.0f);
return rv;
}
diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp
index 12f67208c1..fda47c7a87 100644
--- a/indra/llcommon/llsdutil.cpp
+++ b/indra/llcommon/llsdutil.cpp
@@ -32,8 +32,7 @@
#include <sstream>
#if LL_WINDOWS
-# define WIN32_LEAN_AND_MEAN
-# include <winsock2.h> // for htonl
+# include "llwin32headers.h" // for htonl
#elif LL_LINUX
# include <netinet/in.h>
#elif LL_DARWIN
@@ -161,7 +160,7 @@ LLSD ll_binary_from_string(const LLSD& sd)
char* ll_print_sd(const LLSD& sd)
{
const U32 bufferSize = 10 * 1024;
- static char buffer[bufferSize];
+ static char buffer[bufferSize + 1];
std::ostringstream stream;
//stream.rdbuf()->pubsetbuf(buffer, bufferSize);
stream << LLSDOStreamer<LLSDXMLFormatter>(sd);
@@ -183,7 +182,7 @@ char* ll_pretty_print_sd_ptr(const LLSD* sd)
char* ll_pretty_print_sd(const LLSD& sd)
{
const U32 bufferSize = 100 * 1024;
- static char buffer[bufferSize];
+ static char buffer[bufferSize + 1];
std::ostringstream stream;
//stream.rdbuf()->pubsetbuf(buffer, bufferSize);
stream << LLSDOStreamer<LLSDXMLFormatter>(sd, LLSDFormatter::OPTIONS_PRETTY);
diff --git a/indra/llcommon/llstacktrace.cpp b/indra/llcommon/llstacktrace.cpp
index ca8f4299d9..c223c26bb0 100644
--- a/indra/llcommon/llstacktrace.cpp
+++ b/indra/llcommon/llstacktrace.cpp
@@ -32,7 +32,7 @@
#include <iostream>
#include <sstream>
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include <dbghelp.h>
typedef USHORT NTAPI RtlCaptureStackBackTrace_Function(
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index 005864a843..447fa2d9dd 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -34,8 +34,7 @@
#include <sstream>
#if LL_WINDOWS
-#include "llwin32headerslean.h"
-#include <winnls.h> // for WideCharToMultiByte
+#include "llwin32headers.h"
#endif
std::string ll_safe_string(const char* in)
@@ -1435,6 +1434,14 @@ bool LLStringUtil::simpleReplacement(std::string &replacement, std::string token
template<>
void LLStringUtil::setLocale(std::string inLocale)
{
+ if(startsWith(inLocale, "MissingString"))
+ {
+ // it seems this hasn't been working for some time, and I'm not sure how it is intentded to
+ // properly discover the correct locale. early out now to avoid failures later in
+ // formatNumber()
+ LL_WARNS() << "Failed attempting to set invalid locale: " << inLocale << LL_ENDL;
+ return;
+ }
sLocale = inLocale;
};
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index 79625ad9f8..7e69ddf6fc 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -59,7 +59,7 @@
using namespace llsd;
#if LL_WINDOWS
-# include "llwin32headerslean.h"
+# include "llwin32headers.h"
# include <psapi.h> // GetPerformanceInfo() et al.
# include <VersionHelpers.h>
#elif LL_DARWIN
@@ -504,57 +504,46 @@ const S32 LLOSInfo::getOSBitness() const
return mOSBitness;
}
-//static
-U32 LLOSInfo::getProcessVirtualSizeKB()
-{
- U32 virtual_size = 0;
-#if LL_LINUX
-# define STATUS_SIZE 2048
- LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb");
- if (status_filep)
- {
- S32 numRead = 0;
- char buff[STATUS_SIZE]; /* Flawfinder: ignore */
+namespace {
- size_t nbytes = fread(buff, 1, STATUS_SIZE-1, status_filep);
- buff[nbytes] = '\0';
+ U32 readFromProcStat( std::string entryName )
+ {
+ U32 val{};
+#if LL_LINUX
+ constexpr U32 STATUS_SIZE = 2048;
- // All these guys return numbers in KB
- char *memp = strstr(buff, "VmSize:");
- if (memp)
+ LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb");
+ if (status_filep)
{
- numRead += sscanf(memp, "%*s %u", &virtual_size);
+ char buff[STATUS_SIZE]; /* Flawfinder: ignore */
+
+ size_t nbytes = fread(buff, 1, STATUS_SIZE-1, status_filep);
+ buff[nbytes] = '\0';
+
+ // All these guys return numbers in KB
+ char *memp = strstr(buff, entryName.c_str());
+ if (memp)
+ {
+ (void) sscanf(memp, "%*s %u", &val);
+ }
+ fclose(status_filep);
}
- fclose(status_filep);
- }
#endif
- return virtual_size;
+ return val;
+ }
+
}
//static
-U32 LLOSInfo::getProcessResidentSizeKB()
+U32 LLOSInfo::getProcessVirtualSizeKB()
{
- U32 resident_size = 0;
-#if LL_LINUX
- LLFILE* status_filep = LLFile::fopen("/proc/self/status", "rb");
- if (status_filep != NULL)
- {
- S32 numRead = 0;
- char buff[STATUS_SIZE]; /* Flawfinder: ignore */
-
- size_t nbytes = fread(buff, 1, STATUS_SIZE-1, status_filep);
- buff[nbytes] = '\0';
+ return readFromProcStat( "VmSize:" );
+}
- // All these guys return numbers in KB
- char *memp = strstr(buff, "VmRSS:");
- if (memp)
- {
- numRead += sscanf(memp, "%*s %u", &resident_size);
- }
- fclose(status_filep);
- }
-#endif
- return resident_size;
+//static
+U32 LLOSInfo::getProcessResidentSizeKB()
+{
+ return readFromProcStat( "VmRSS:" );
}
//static
@@ -1118,6 +1107,14 @@ LLSD LLMemoryInfo::loadStatsMap()
LLSD::String key(matched[1].first, matched[1].second);
LLSD::String value_str(matched[2].first, matched[2].second);
LLSD::Integer value(0);
+
+ // Skip over VmallocTotal. It's just a fixed and huge number on (modern) systems. "34359738367 kB"
+ // https://unix.stackexchange.com/questions/700724/why-is-vmalloctotal-34359738367-kb
+ // If not skipped converting it to a LLSD::integer (32 bit) will fail and spam the logs (this function
+ // is called quite frequently).
+ if( key == "VmallocTotal")
+ continue;
+
try
{
value = boost::lexical_cast<LLSD::Integer>(value_str);
diff --git a/indra/llcommon/lltimer.cpp b/indra/llcommon/lltimer.cpp
index 28d6e4e4cc..f36d223100 100644
--- a/indra/llcommon/lltimer.cpp
+++ b/indra/llcommon/lltimer.cpp
@@ -34,7 +34,7 @@
#include <thread>
#if LL_WINDOWS
-# include "llwin32headerslean.h"
+# include "llwin32headers.h"
#elif LL_LINUX || LL_DARWIN
# include <errno.h>
# include <sys/time.h>
diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index 7aeabc3c4a..b9bd27aa17 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -25,11 +25,8 @@
#include "linden_common.h"
- // We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.
#if LL_WINDOWS
#include "llwin32headers.h"
-// ugh, this is ugly. We need to straighten out our linking for this library
-#pragma comment(lib, "IPHLPAPI.lib")
#include <iphlpapi.h>
#include <nb30.h>
#endif
diff --git a/indra/llcommon/llwin32headers.h b/indra/llcommon/llwin32headers.h
index f679adc200..df433deb7a 100644
--- a/indra/llcommon/llwin32headers.h
+++ b/indra/llcommon/llwin32headers.h
@@ -28,15 +28,8 @@
#define LL_LLWINDOWS_H
#ifdef LL_WINDOWS
-#ifndef NOMINMAX
-#define NOMINMAX
-#endif
-#undef WIN32_LEAN_AND_MEAN
-#include <winsock2.h>
-#include <windows.h>
-// reset to default, which is lean
-#define WIN32_LEAN_AND_MEAN
-#undef NOMINMAX
+#include <windows.h> // Does not include winsock.h because WIN32_LEAN_AND_MEAN is defined
+#include <winsock2.h> // Requires windows.h
#endif
#endif
diff --git a/indra/llcommon/llwin32headerslean.h b/indra/llcommon/llwin32headerslean.h
deleted file mode 100644
index 97c8edb8cf..0000000000
--- a/indra/llcommon/llwin32headerslean.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * @file llwin32headerslean.h
- * @brief sanitized include of windows header files
- *
- * $LicenseInfo:firstyear=2001&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef LL_LLWINDOWS_H
-#define LL_LLWINDOWS_H
-
-#ifdef LL_WINDOWS
-#ifndef NOMINMAX
-#define NOMINMAX
-#endif
-#define WIN32_LEAN_AND_MEAN
-#include <winsock2.h>
-#include <windows.h>
-#undef NOMINMAX
-#endif
-
-#endif
diff --git a/indra/llcommon/tests/llleap_test.cpp b/indra/llcommon/tests/llleap_test.cpp
index a345608299..773b373e72 100644
--- a/indra/llcommon/tests/llleap_test.cpp
+++ b/indra/llcommon/tests/llleap_test.cpp
@@ -35,7 +35,7 @@
// causes Windows abdominal pain such that it later fails code-signing in some
// mysterious way. Entirely suppressing these LLLeap tests pushes the failure
// rate MUCH lower. Can we re-enable them with a smaller data size on Windows?
-const size_t BUFFERED_LENGTH = 100*1024;
+const size_t BUFFERED_LENGTH = 1023*1024;
#else // not Windows
const size_t BUFFERED_LENGTH = 1023*1024; // try wrangling just under a megabyte of data
diff --git a/indra/llcommon/tests/llstring_test.cpp b/indra/llcommon/tests/llstring_test.cpp
index b18712b8e9..b68c63a15f 100644
--- a/indra/llcommon/tests/llstring_test.cpp
+++ b/indra/llcommon/tests/llstring_test.cpp
@@ -377,7 +377,7 @@ namespace tut
{
F32 value;
std::string str_val("2147483647"); //0x7FFFFFFF
- ensure("1: convertToF32 failed", LLStringUtil::convertToF32(str_val, value) && value == 2147483647);
+ ensure("1: convertToF32 failed", LLStringUtil::convertToF32(str_val, value) && value == 2147483647.f);
str_val = "0";
ensure("2: convertToF32 failed", LLStringUtil::convertToF32(str_val, value) && value == 0);
@@ -399,7 +399,7 @@ namespace tut
{
F64 value;
std::string str_val("9223372036854775807"); //0x7FFFFFFFFFFFFFFF
- ensure("1: convertToF64 failed", LLStringUtil::convertToF64(str_val, value) && value == 9223372036854775807LL);
+ ensure("1: convertToF64 failed", LLStringUtil::convertToF64(str_val, value) && value == 9223372036854775807.);
str_val = "0";
ensure("2: convertToF64 failed", LLStringUtil::convertToF64(str_val, value) && value == 0.0F);
diff --git a/indra/llcorehttp/CMakeLists.txt b/indra/llcorehttp/CMakeLists.txt
index 05b788a433..b141171516 100644
--- a/indra/llcorehttp/CMakeLists.txt
+++ b/indra/llcorehttp/CMakeLists.txt
@@ -10,7 +10,6 @@ include(ZLIBNG)
include(LLCoreHttp)
include(LLAddBuildTest)
include(LLCommon)
-include(Tut)
include(bugsplat)
set(llcorehttp_SOURCE_FILES
diff --git a/indra/llcorehttp/tests/llcorehttp_test.cpp b/indra/llcorehttp/tests/llcorehttp_test.cpp
index c0cc2c8030..8a788e5a93 100755
--- a/indra/llcorehttp/tests/llcorehttp_test.cpp
+++ b/indra/llcorehttp/tests/llcorehttp_test.cpp
@@ -43,9 +43,12 @@
#include "test_httpoperation.hpp"
// As of 2019-06-28, test_httprequest.hpp consistently crashes on Mac Release
// builds for reasons not yet diagnosed.
-#if ! (LL_DARWIN && LL_RELEASE)
+// On Linux too, this is likely to badly handling (p)thread creation and not waiting
+// for threads to properly shutdown
+#if LL_WINDOWS
#include "test_httprequest.hpp"
#endif
+
#include "test_httpheaders.hpp"
#include "test_httprequestqueue.hpp"
#include "_httpservice.h"
diff --git a/indra/llfilesystem/tests/lldir_test.cpp b/indra/llfilesystem/tests/lldir_test.cpp
index 6e191ad096..4fa5769f65 100644
--- a/indra/llfilesystem/tests/lldir_test.cpp
+++ b/indra/llfilesystem/tests/lldir_test.cpp
@@ -27,12 +27,14 @@
#include "linden_common.h"
+#include <filesystem>
#include "llstring.h"
#include "tests/StringVec.h"
#include "../lldir.h"
#include "../lldiriterator.h"
#include "../test/lltut.h"
+#include "../test/namedtempfile.h"
#include "stringize.h"
#include <boost/assign/list_of.hpp>
@@ -425,23 +427,19 @@ namespace tut
return path;
}
- std::string makeTestDir( const std::string& dirbase )
+ std::string makeTestDir( )
{
- int counter;
- std::string uniqueDir;
- bool foundUnused;
- std::string delim = gDirUtilp->getDirDelimiter();
+ auto p = NamedTempFile::temp_path();
+ std::filesystem::create_directories(p.native());
- for (counter=0, foundUnused=false; !foundUnused; counter++ )
- {
- char counterStr[3];
- sprintf(counterStr, "%02d", counter);
- uniqueDir = dirbase + counterStr;
- foundUnused = ! ( LLFile::isdir(uniqueDir) || LLFile::isfile(uniqueDir) );
- }
- ensure("test directory '" + uniqueDir + "' creation failed", !LLFile::mkdir(uniqueDir));
+ std::string ret = p.string();
- return uniqueDir + delim; // HACK - apparently, the trailing delimiter is needed...
+ // There's an implicit assumtion all over this code that the returned path ends with "/" (or "\")
+
+ if(ret.size() >= 1 && ret[ ret.size()-1 ] != std::filesystem::path::preferred_separator )
+ ret += std::filesystem::path::preferred_separator;
+
+ return ret;
}
static const char* DirScanFilename[5] = { "file1.abc", "file2.abc", "file1.xyz", "file2.xyz", "file1.mno" };
@@ -497,8 +495,9 @@ namespace tut
// Create the same 5 file names of the two directories
- std::string dir1 = makeTestDir(dirTemp + "LLDirIterator");
- std::string dir2 = makeTestDir(dirTemp + "LLDirIterator");
+ std::string dir1 = makeTestDir();
+ std::string dir2 = makeTestDir();
+
std::string dir1files[5];
std::string dir2files[5];
for (int i=0; i<5; i++)
diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h
index 8b966b8ea3..6b14b68c78 100644
--- a/indra/llimage/llimage.h
+++ b/indra/llimage/llimage.h
@@ -179,7 +179,7 @@ private:
public:
template<bool SHARED>
- class DataLock : LLSharedMutexLockTemplate<SHARED>
+ class DataLock : public LLSharedMutexLockTemplate<SHARED>
{
public:
DataLock(const LLImageBase* image)
diff --git a/indra/llimage/llimagefilter.cpp b/indra/llimage/llimagefilter.cpp
index bfcb1f76de..3b12aa39e4 100644
--- a/indra/llimage/llimagefilter.cpp
+++ b/indra/llimage/llimagefilter.cpp
@@ -389,6 +389,11 @@ void LLImageFilter::convolve(const LLMatrix3 &kernel, bool normalize, bool abs_v
S32 buffer_size = width * components;
llassert_always(buffer_size > 0);
+
+ // ND: GCC womtimes is unable to figure out llassert_always (aka LLERROR_CRASH) will never return.
+ // This return here is just a dummy and will not be reached.
+ if( buffer_size == 0 ){return; }
+
std::vector<U8> even_buffer(buffer_size);
std::vector<U8> odd_buffer(buffer_size);
diff --git a/indra/llimagej2coj/llimagej2coj.cpp b/indra/llimagej2coj/llimagej2coj.cpp
index f4bcb97a5d..6037517103 100644
--- a/indra/llimagej2coj/llimagej2coj.cpp
+++ b/indra/llimagej2coj/llimagej2coj.cpp
@@ -617,7 +617,6 @@ public:
for (S32 c = 0; c < numcomps; c++)
{
cmptparm[c].prec = 8;
- cmptparm[c].bpp = 8;
cmptparm[c].sgnd = 0;
cmptparm[c].dx = parameters.subsampling_dx;
cmptparm[c].dy = parameters.subsampling_dy;
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index 4aab3dee3b..0ee71de3a1 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -69,25 +69,99 @@ const U32 LLSettingsBase::Validator::VALIDATION_PARTIAL(0x01 << 0);
LLSettingsBase::LLSettingsBase():
mSettings(LLSD::emptyMap()),
mDirty(true),
- mBlendedFactor(0.0)
+ mLLSDDirty(true),
+ mReplaced(false),
+ mBlendedFactor(0.0),
+ mSettingFlags(0)
{
}
LLSettingsBase::LLSettingsBase(const LLSD setting) :
mSettings(setting),
+ mLLSDDirty(true),
mDirty(true),
- mBlendedFactor(0.0)
+ mReplaced(false),
+ mBlendedFactor(0.0),
+ mSettingFlags(0)
{
}
+//virtual
+void LLSettingsBase::loadValuesFromLLSD()
+{
+ mLLSDDirty = false;
+
+ mAssetId = mSettings[SETTING_ASSETID].asUUID();
+ mSettingId = getValue(SETTING_ID).asUUID();
+ mSettingName = getValue(SETTING_NAME).asString();
+ if (mSettings.has(SETTING_FLAGS))
+ {
+ mSettingFlags = (U32)mSettings[SETTING_FLAGS].asInteger();
+ }
+ else
+ {
+ mSettingFlags = 0;
+ }
+}
+
+//virtual
+void LLSettingsBase::saveValuesToLLSD()
+{
+ mLLSDDirty = false;
+
+ mSettings[SETTING_NAME] = mSettingName;
+ if (mAssetId.isNull())
+ {
+ mSettings.erase(SETTING_ASSETID);
+ }
+ else
+ {
+ mSettings[SETTING_ASSETID] = mAssetId;
+ }
+ mSettings[SETTING_FLAGS] = LLSD::Integer(mSettingFlags);
+}
+
+void LLSettingsBase::saveValuesIfNeeded()
+{
+ if (mLLSDDirty)
+ {
+ saveValuesToLLSD();
+ }
+}
+
//=========================================================================
-void LLSettingsBase::lerpSettings(const LLSettingsBase &other, F64 mix)
+void LLSettingsBase::lerpSettings(LLSettingsBase &other, F64 mix)
{
- mSettings = interpolateSDMap(mSettings, other.mSettings, other.getParameterMap(), mix);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
+ saveValuesIfNeeded();
+ stringset_t skip = getSkipInterpolateKeys();
+ stringset_t slerps = getSlerpKeys();
+ mSettings = interpolateSDMap(mSettings, other.getSettings(), other.getParameterMap(), mix, skip, slerps);
setDirtyFlag(true);
+ loadValuesFromLLSD();
+}
+
+void LLSettingsBase::lerpVector2(LLVector2& a, const LLVector2& b, F32 mix)
+{
+ a.mV[0] = lerp(a.mV[0], b.mV[0], mix);
+ a.mV[1] = lerp(a.mV[1], b.mV[1], mix);
}
-LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) const
+void LLSettingsBase::lerpVector3(LLVector3& a, const LLVector3& b, F32 mix)
+{
+ a.mV[0] = lerp(a.mV[0], b.mV[0], mix);
+ a.mV[1] = lerp(a.mV[1], b.mV[1], mix);
+ a.mV[2] = lerp(a.mV[2], b.mV[2], mix);
+}
+
+void LLSettingsBase::lerpColor(LLColor3& a, const LLColor3& b, F32 mix)
+{
+ a.mV[0] = lerp(a.mV[0], b.mV[0], mix);
+ a.mV[1] = lerp(a.mV[1], b.mV[1], mix);
+ a.mV[2] = lerp(a.mV[2], b.mV[2], mix);
+}
+
+LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other)
{
LLSD newSettings;
@@ -161,13 +235,10 @@ LLSD LLSettingsBase::combineSDMaps(const LLSD &settings, const LLSD &other) cons
return newSettings;
}
-LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, F64 mix) const
+LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, F64 mix, const stringset_t& skip, const stringset_t& slerps)
{
LLSD newSettings;
- stringset_t skip = getSkipInterpolateKeys();
- stringset_t slerps = getSlerpKeys();
-
llassert(mix >= 0.0f && mix <= 1.0f);
for (LLSD::map_const_iterator it = settings.beginMap(); it != settings.endMap(); ++it)
@@ -204,7 +275,7 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c
}
}
- newSettings[key_name] = interpolateSDValue(key_name, value, other_value, defaults, mix, slerps);
+ newSettings[key_name] = interpolateSDValue(key_name, value, other_value, defaults, mix, skip, slerps);
}
// Special handling cases
@@ -233,12 +304,12 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c
if (def_iter != defaults.end())
{
// Blend against default value
- newSettings[key_name] = interpolateSDValue(key_name, def_iter->second.getDefaultValue(), (*it).second, defaults, mix, slerps);
+ newSettings[key_name] = interpolateSDValue(key_name, def_iter->second.getDefaultValue(), (*it).second, defaults, mix, skip, slerps);
}
else if ((*it).second.type() == LLSD::TypeMap)
{
// interpolate in case there are defaults inside (part of legacy)
- newSettings[key_name] = interpolateSDValue(key_name, LLSDMap(), (*it).second, defaults, mix, slerps);
+ newSettings[key_name] = interpolateSDValue(key_name, LLSDMap(), (*it).second, defaults, mix, skip, slerps);
}
// else do nothing when no known defaults
// TODO: Should I blend this out instead?
@@ -260,7 +331,7 @@ LLSD LLSettingsBase::interpolateSDMap(const LLSD &settings, const LLSD &other, c
return newSettings;
}
-LLSD LLSettingsBase::interpolateSDValue(const std::string& key_name, const LLSD &value, const LLSD &other_value, const parammapping_t& defaults, BlendFactor mix, const stringset_t& slerps) const
+LLSD LLSettingsBase::interpolateSDValue(const std::string& key_name, const LLSD &value, const LLSD &other_value, const parammapping_t& defaults, BlendFactor mix, const stringset_t& skip, const stringset_t& slerps)
{
LLSD new_value;
@@ -286,7 +357,7 @@ LLSD LLSettingsBase::interpolateSDValue(const std::string& key_name, const LLSD
break;
case LLSD::TypeMap:
// deep copy.
- new_value = interpolateSDMap(value, other_value, defaults, mix);
+ new_value = interpolateSDMap(value, other_value, defaults, mix, skip, slerps);
break;
case LLSD::TypeArray:
@@ -348,13 +419,15 @@ LLSettingsBase::stringset_t LLSettingsBase::getSkipInterpolateKeys() const
return skipSet;
}
-LLSD LLSettingsBase::getSettings() const
+LLSD& LLSettingsBase::getSettings()
{
+ saveValuesIfNeeded();
return mSettings;
}
-LLSD LLSettingsBase::cloneSettings() const
+LLSD LLSettingsBase::cloneSettings()
{
+ saveValuesIfNeeded();
LLSD settings(combineSDMaps(getSettings(), LLSD()));
if (U32 flags = getFlags())
{
@@ -363,7 +436,7 @@ LLSD LLSettingsBase::cloneSettings() const
return settings;
}
-size_t LLSettingsBase::getHash() const
+size_t LLSettingsBase::getHash()
{ // get a shallow copy of the LLSD filtering out values to not include in the hash
LLSD hash_settings = llsd_shallow(getSettings(),
LLSDMap(SETTING_NAME, false)(SETTING_ID, false)(SETTING_HASH, false)("*", true));
@@ -381,7 +454,9 @@ bool LLSettingsBase::validate()
mSettings[SETTING_TYPE] = getSettingsType();
}
+ saveValuesIfNeeded();
LLSD result = LLSettingsBase::settingValidation(mSettings, validations);
+ loadValuesFromLLSD();
if (result["errors"].size() > 0)
{
@@ -704,7 +779,7 @@ F64 LLSettingsBlender::setBlendFactor(const LLSettingsBase::BlendFactor& blendf_
if (mTarget)
{
- mTarget->replaceSettings(mInitial->getSettings());
+ mTarget->replaceSettings(mInitial);
mTarget->blend(mFinal, blendf);
}
else
@@ -719,7 +794,7 @@ void LLSettingsBlender::triggerComplete()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
if (mTarget)
- mTarget->replaceSettings(mFinal->getSettings());
+ mTarget->replaceSettings(mFinal);
LLSettingsBlender::ptr_t hold = shared_from_this(); // prevents this from deleting too soon
mTarget->update();
mOnFinished(shared_from_this());
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index 9d8d746b7e..816ff3e111 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -109,72 +109,59 @@ public:
virtual bool isDirty() const { return mDirty; }
virtual bool isVeryDirty() const { return mReplaced; }
inline void setDirtyFlag(bool dirty) { mDirty = dirty; clearAssetId(); }
+ inline void setReplaced() { mReplaced = true; }
- size_t getHash() const; // Hash will not include Name, ID or a previously stored Hash
+ size_t getHash(); // Hash will not include Name, ID or a previously stored Hash
inline LLUUID getId() const
{
- return getValue(SETTING_ID).asUUID();
+ return mSettingId;
}
inline std::string getName() const
{
- return getValue(SETTING_NAME).asString();
+ return mSettingName;
}
inline void setName(std::string val)
{
- setValue(SETTING_NAME, val);
+ mSettingName = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
inline LLUUID getAssetId() const
{
- if (mSettings.has(SETTING_ASSETID))
- return mSettings[SETTING_ASSETID].asUUID();
- return LLUUID();
+ return mAssetId;
}
inline U32 getFlags() const
{
- if (mSettings.has(SETTING_FLAGS))
- return static_cast<U32>(mSettings[SETTING_FLAGS].asInteger());
- return 0;
+ return mSettingFlags;
}
inline void setFlags(U32 value)
{
- setLLSD(SETTING_FLAGS, LLSD::Integer(value));
+ mSettingFlags = value;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
inline bool getFlag(U32 flag) const
{
- if (mSettings.has(SETTING_FLAGS))
- return ((U32)mSettings[SETTING_FLAGS].asInteger() & flag) == flag;
- return false;
+ return (mSettingFlags & flag) == flag;
}
inline void setFlag(U32 flag)
{
- U32 flags((mSettings.has(SETTING_FLAGS)) ? (U32)mSettings[SETTING_FLAGS].asInteger() : 0);
-
- flags |= flag;
-
- if (flags)
- mSettings[SETTING_FLAGS] = LLSD::Integer(flags);
- else
- mSettings.erase(SETTING_FLAGS);
+ mSettingFlags |= flag;
+ setLLSDDirty();
}
inline void clearFlag(U32 flag)
{
- U32 flags((mSettings.has(SETTING_FLAGS)) ? (U32)mSettings[SETTING_FLAGS].asInteger() : 0);
-
- flags &= ~flag;
-
- if (flags)
- mSettings[SETTING_FLAGS] = LLSD::Integer(flags);
- else
- mSettings.erase(SETTING_FLAGS);
+ mSettingFlags &= ~flag;
+ setLLSDDirty();
}
virtual void replaceSettings(LLSD settings)
@@ -183,14 +170,41 @@ public:
setDirtyFlag(true);
mReplaced = true;
mSettings = settings;
+ loadValuesFromLLSD();
+ }
+
+ virtual void replaceSettings(const ptr_t& other)
+ {
+ mBlendedFactor = 0.0;
+ setDirtyFlag(true);
+ mReplaced = true;
+ mSettingFlags = other->getFlags();
+ mSettingName = other->getName();
+ mSettingId = other->getId();
+ mAssetId = other->getAssetId();
+ setLLSDDirty();
+ }
+
+ void setSettings(LLSD settings)
+ {
+ setDirtyFlag(true);
+ mSettings = settings;
+ loadValuesFromLLSD();
}
- virtual LLSD getSettings() const;
+ // if you are using getSettings to edit them, call setSettings(settings),
+ // replaceSettings(settings) or loadValuesFromLLSD() afterwards
+ virtual LLSD& getSettings();
+ virtual void setLLSDDirty()
+ {
+ mLLSDDirty = true;
+ }
//---------------------------------------------------------------------
//
inline void setLLSD(const std::string &name, const LLSD &value)
{
+ saveValuesIfNeeded();
mSettings[name] = value;
mDirty = true;
if (name != SETTING_ASSETID)
@@ -202,8 +216,9 @@ public:
setLLSD(name, value);
}
- inline LLSD getValue(const std::string &name, const LLSD &deflt = LLSD()) const
+ inline LLSD getValue(const std::string &name, const LLSD &deflt = LLSD())
{
+ saveValuesIfNeeded();
if (!mSettings.has(name))
return deflt;
return mSettings[name];
@@ -259,11 +274,11 @@ public:
(const_cast<LLSettingsBase *>(this))->updateSettings();
}
- virtual void blend(const ptr_t &end, BlendFactor blendf) = 0;
+ virtual void blend(ptr_t &end, BlendFactor blendf) = 0;
virtual bool validate();
- virtual ptr_t buildDerivedClone() const = 0;
+ virtual ptr_t buildDerivedClone() = 0;
class Validator
{
@@ -310,17 +325,24 @@ public:
inline void setAssetId(LLUUID value)
{ // note that this skips setLLSD
- mSettings[SETTING_ASSETID] = value;
+ mAssetId = value;
+ mLLSDDirty = true;
}
inline void clearAssetId()
{
- if (mSettings.has(SETTING_ASSETID))
- mSettings.erase(SETTING_ASSETID);
+ mAssetId.setNull();
+ mLLSDDirty = true;
}
// Calculate any custom settings that may need to be cached.
virtual void updateSettings() { mDirty = false; mReplaced = false; }
+ LLSD cloneSettings();
+
+ static void lerpVector2(LLVector2& a, const LLVector2& b, F32 mix);
+ static void lerpVector3(LLVector3& a, const LLVector3& b, F32 mix);
+ static void lerpColor(LLColor3& a, const LLColor3& b, F32 mix);
+
protected:
LLSettingsBase();
@@ -331,7 +353,7 @@ protected:
typedef std::set<std::string> stringset_t;
// combining settings objects. Customize for specific setting types
- virtual void lerpSettings(const LLSettingsBase &other, BlendFactor mix);
+ virtual void lerpSettings(LLSettingsBase &other, BlendFactor mix);
// combining settings maps where it can based on mix rate
// @settings initial value (mix==0)
@@ -339,8 +361,8 @@ protected:
// @defaults list of default values for legacy fields and (re)setting shaders
// @mix from 0 to 1, ratio or rate of transition from initial 'settings' to 'other'
// return interpolated and combined LLSD map
- LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, BlendFactor mix) const;
- LLSD interpolateSDValue(const std::string& name, const LLSD &value, const LLSD &other, const parammapping_t& defaults, BlendFactor mix, const stringset_t& slerps) const;
+ static LLSD interpolateSDMap(const LLSD &settings, const LLSD &other, const parammapping_t& defaults, BlendFactor mix, const stringset_t& skip, const stringset_t& slerps);
+ static LLSD interpolateSDValue(const std::string& name, const LLSD &value, const LLSD &other, const parammapping_t& defaults, BlendFactor mix, const stringset_t& skip, const stringset_t& slerps);
/// when lerping between settings, some may require special handling.
/// Get a list of these key to be skipped by the default settings lerp.
@@ -353,32 +375,40 @@ protected:
virtual validation_list_t getValidationList() const = 0;
- // Apply any settings that need special handling.
- virtual void applySpecial(void *, bool force = false) { };
+ // Apply settings.
+ virtual void applyToUniforms(void *) { };
+ virtual void applySpecial(void*, bool force = false) { };
virtual parammapping_t getParameterMap() const { return parammapping_t(); }
- LLSD mSettings;
-
- LLSD cloneSettings() const;
-
inline void setBlendFactor(BlendFactor blendfactor)
{
mBlendedFactor = blendfactor;
}
- void replaceWith(LLSettingsBase::ptr_t other)
+ virtual void replaceWith(const LLSettingsBase::ptr_t other)
{
- replaceSettings(other->cloneSettings());
+ replaceSettings(other);
setBlendFactor(other->getBlendFactor());
}
+ virtual void loadValuesFromLLSD();
+ virtual void saveValuesToLLSD();
+ void saveValuesIfNeeded();
+
+ LLUUID mAssetId;
+ LLUUID mSettingId;
+ std::string mSettingName;
+ U32 mSettingFlags;
+
private:
+ bool mLLSDDirty;
bool mDirty;
bool mReplaced; // super dirty!
- LLSD combineSDMaps(const LLSD &first, const LLSD &other) const;
+ static LLSD combineSDMaps(const LLSD &first, const LLSD &other);
+ LLSD mSettings;
BlendFactor mBlendedFactor;
};
diff --git a/indra/llinventory/llsettingsdaycycle.cpp b/indra/llinventory/llsettingsdaycycle.cpp
index 1e7de94414..2b189e7cca 100644
--- a/indra/llinventory/llsettingsdaycycle.cpp
+++ b/indra/llinventory/llsettingsdaycycle.cpp
@@ -124,33 +124,42 @@ static const F32 DEFAULT_MULTISLIDER_INCREMENT(0.005f);
//=========================================================================
LLSettingsDay::LLSettingsDay(const LLSD &data) :
LLSettingsBase(data),
- mInitialized(false)
+ mInitialized(false),
+ mDaySettings(LLSD::emptyMap())
{
mDayTracks.resize(TRACK_MAX);
+ loadValuesFromLLSD();
}
LLSettingsDay::LLSettingsDay() :
LLSettingsBase(),
- mInitialized(false)
+ mInitialized(false),
+ mDaySettings(LLSD::emptyMap())
{
mDayTracks.resize(TRACK_MAX);
+ replaceSettings(defaults());
}
//=========================================================================
-LLSD LLSettingsDay::getSettings() const
+LLSD& LLSettingsDay::getSettings()
{
- LLSD settings(LLSD::emptyMap());
+ if (!mDaySettings.emptyMap())
+ {
+ return mDaySettings;
+ }
+ mDaySettings = LLSD::emptyMap();
+ LLSD& settings = LLSettingsBase::getSettings();
- if (mSettings.has(SETTING_NAME))
- settings[SETTING_NAME] = mSettings[SETTING_NAME];
+ if (settings.has(SETTING_NAME))
+ mDaySettings[SETTING_NAME] = settings[SETTING_NAME];
- if (mSettings.has(SETTING_ID))
- settings[SETTING_ID] = mSettings[SETTING_ID];
+ if (settings.has(SETTING_ID))
+ mDaySettings[SETTING_ID] = settings[SETTING_ID];
- if (mSettings.has(SETTING_ASSETID))
- settings[SETTING_ASSETID] = mSettings[SETTING_ASSETID];
+ if (settings.has(SETTING_ASSETID))
+ mDaySettings[SETTING_ASSETID] = settings[SETTING_ASSETID];
- settings[SETTING_TYPE] = getSettingsType();
+ mDaySettings[SETTING_TYPE] = getSettingsType();
std::map<std::string, LLSettingsBase::ptr_t> in_use;
@@ -174,7 +183,7 @@ LLSD LLSettingsDay::getSettings() const
}
tracks.append(trackout);
}
- settings[SETTING_TRACKS] = tracks;
+ mDaySettings[SETTING_TRACKS] = tracks;
LLSD frames(LLSD::emptyMap());
for (std::map<std::string, LLSettingsBase::ptr_t>::iterator itFrame = in_use.begin(); itFrame != in_use.end(); ++itFrame)
@@ -184,9 +193,15 @@ LLSD LLSettingsDay::getSettings() const
frames[(*itFrame).first] = framesettings;
}
- settings[SETTING_FRAMES] = frames;
+ mDaySettings[SETTING_FRAMES] = frames;
- return settings;
+ return mDaySettings;
+}
+
+void LLSettingsDay::setLLSDDirty()
+{
+ mDaySettings = LLSD::emptyMap();
+ LLSettingsBase::setLLSDDirty();
}
bool LLSettingsDay::initialize(bool validate_frames)
@@ -392,6 +407,8 @@ bool LLSettingsDay::initialize(bool validate_frames)
mSettings[SETTING_ASSETID] = assetid;
}
+ loadValuesFromLLSD();
+
mInitialized = true;
return true;
}
@@ -449,7 +466,7 @@ LLSD LLSettingsDay::defaults()
return dfltsetting;
}
-void LLSettingsDay::blend(const LLSettingsBase::ptr_t &other, F64 mix)
+void LLSettingsDay::blend(LLSettingsBase::ptr_t &other, F64 mix)
{
LL_ERRS("DAYCYCLE") << "Day cycles are not blendable!" << LL_ENDL;
}
diff --git a/indra/llinventory/llsettingsdaycycle.h b/indra/llinventory/llsettingsdaycycle.h
index 917b0870f2..d37423ea9a 100644
--- a/indra/llinventory/llsettingsdaycycle.h
+++ b/indra/llinventory/llsettingsdaycycle.h
@@ -81,9 +81,10 @@ public:
bool initialize(bool validate_frames = false);
- virtual ptr_t buildClone() const = 0;
- virtual ptr_t buildDeepCloneAndUncompress() const = 0;
- virtual LLSD getSettings() const SETTINGS_OVERRIDE;
+ virtual ptr_t buildClone() = 0;
+ virtual ptr_t buildDeepCloneAndUncompress() = 0;
+ virtual LLSD& getSettings() SETTINGS_OVERRIDE;
+ virtual void setLLSDDirty() override;
virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_DAYCYCLE; }
@@ -91,7 +92,7 @@ public:
virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("daycycle"); }
// Settings status
- virtual void blend(const LLSettingsBase::ptr_t &other, F64 mix) SETTINGS_OVERRIDE;
+ virtual void blend(LLSettingsBase::ptr_t &other, F64 mix) SETTINGS_OVERRIDE;
static LLSD defaults();
@@ -127,7 +128,7 @@ public:
virtual validation_list_t getValidationList() const SETTINGS_OVERRIDE;
static validation_list_t validationList();
- virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); }
+ virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
LLSettingsBase::TrackPosition getUpperBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe);
LLSettingsBase::TrackPosition getLowerBoundFrame(S32 track, const LLSettingsBase::TrackPosition& keyframe);
@@ -143,6 +144,7 @@ protected:
private:
CycleList_t mDayTracks;
+ LLSD mDaySettings;
LLSettingsBase::Seconds mLastUpdateTime;
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index cbec2f4906..3685915ffd 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -407,10 +407,11 @@ LLSettingsSky::LLSettingsSky(const LLSD &data) :
mNextRainbowTextureId(),
mNextHaloTextureId()
{
+ loadValuesFromLLSD();
}
LLSettingsSky::LLSettingsSky():
- LLSettingsBase(),
+ LLSettingsBase(LLSettingsSky::defaults()),
mNextSunTextureId(),
mNextMoonTextureId(),
mNextCloudTextureId(),
@@ -418,6 +419,7 @@ LLSettingsSky::LLSettingsSky():
mNextRainbowTextureId(),
mNextHaloTextureId()
{
+ replaceSettings(defaults());
}
void LLSettingsSky::replaceSettings(LLSD settings)
@@ -431,7 +433,80 @@ void LLSettingsSky::replaceSettings(LLSD settings)
mNextHaloTextureId.setNull();
}
-void LLSettingsSky::replaceWithSky(LLSettingsSky::ptr_t pother)
+void LLSettingsSky::replaceSettings(const LLSettingsBase::ptr_t& other_sky)
+{
+ LLSettingsBase::replaceSettings(other_sky);
+
+ llassert(getSettingsType() == other_sky->getSettingsType());
+
+ LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast<LLSettingsSky>(other_sky);
+
+ mCanAutoAdjust = other->mCanAutoAdjust;
+ mReflectionProbeAmbiance = other->mReflectionProbeAmbiance;
+
+ mSunScale = other->mSunScale;
+ mSunRotation = other->mSunRotation;
+ mSunlightColor = other->mSunlightColor;
+ mStarBrightness = other->mStarBrightness;
+ mMoonBrightness = other->mMoonBrightness;
+ mMoonScale = other->mMoonScale;
+ mMoonRotation = other->mMoonRotation;
+ mMaxY = other->mMaxY;
+ mGlow = other->mGlow;
+ mGamma = other->mGamma;
+ mCloudVariance = other->mCloudVariance;
+ mCloudShadow = other->mCloudShadow;
+ mScrollRate = other->mScrollRate;
+ mCloudScale = other->mCloudScale;
+ mCloudPosDensity1 = other->mCloudPosDensity1;
+ mCloudPosDensity2 = other->mCloudPosDensity2;
+ mCloudColor = other->mCloudColor;
+
+ mAbsorptionConfigs = other->mAbsorptionConfigs;
+ mMieConfigs = other->mMieConfigs;
+ mRayleighConfigs = other->mRayleighConfigs;
+
+ mSunArcRadians = other->mSunArcRadians;
+ mSkyTopRadius = other->mSkyTopRadius;
+ mSkyBottomRadius = other->mSkyBottomRadius;
+ mSkyMoistureLevel = other->mSkyMoistureLevel;
+ mSkyDropletRadius = other->mSkyDropletRadius;
+ mSkyIceLevel = other->mSkyIceLevel;
+ mPlanetRadius = other->mPlanetRadius;
+
+ mHasLegacyHaze = other->mHasLegacyHaze;
+ mDistanceMultiplier = other->mDistanceMultiplier;
+ mDensityMultiplier = other->mDensityMultiplier;
+ mHazeHorizon = other->mHazeHorizon;
+ mHazeDensity = other->mHazeDensity;
+ mBlueHorizon = other->mBlueHorizon;
+ mBlueDensity = other->mBlueDensity;
+ mAmbientColor = other->mAmbientColor;
+
+ mLegacyDistanceMultiplier = other->mLegacyDistanceMultiplier;
+ mLegacyDensityMultiplier = other->mLegacyDensityMultiplier;
+ mLegacyHazeHorizon = other->mLegacyHazeHorizon;
+ mLegacyHazeDensity = other->mLegacyHazeDensity;
+ mLegacyBlueHorizon = other->mLegacyBlueHorizon;
+ mLegacyBlueDensity = other->mLegacyBlueDensity;
+ mLegacyAmbientColor = other->mLegacyAmbientColor;
+
+ mSunTextureId = other->mSunTextureId;
+ mMoonTextureId = other->mMoonTextureId;
+ mCloudTextureId = other->mCloudTextureId;
+ mHaloTextureId = other->mHaloTextureId;
+ mRainbowTextureId = other->mRainbowTextureId;
+ mBloomTextureId = other->mBloomTextureId;
+
+ mNextSunTextureId.setNull();
+ mNextMoonTextureId.setNull();
+ mNextCloudTextureId.setNull();
+ mNextBloomTextureId.setNull();
+ mNextRainbowTextureId.setNull();
+ mNextHaloTextureId.setNull();
+}
+
+void LLSettingsSky::replaceWithSky(const LLSettingsSky::ptr_t& pother)
{
replaceWith(pother);
@@ -443,61 +518,158 @@ void LLSettingsSky::replaceWithSky(LLSettingsSky::ptr_t pother)
mNextHaloTextureId = pother->mNextHaloTextureId;
}
-void LLSettingsSky::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
+bool lerp_legacy_color(LLColor3& a, bool& a_has_legacy, const LLColor3& b, bool b_has_legacy, const LLColor3& def, F32 mix)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
- llassert(getSettingsType() == end->getSettingsType());
+ if (b_has_legacy)
+ {
+ if (a_has_legacy)
+ {
+ LLSettingsBase::lerpColor(a, b, mix);
+ }
+ else
+ {
+ a = def;
+ LLSettingsBase::lerpColor(a, b, mix);
+ a_has_legacy = true;
+ }
+ }
+ else if (a_has_legacy)
+ {
+ LLSettingsBase::lerpColor(a, def, mix);
+ }
+ else
+ {
+ LLSettingsBase::lerpColor(a, b, mix);
+ }
+ return a_has_legacy;
+}
- LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast<LLSettingsSky>(end);
- if (other)
+bool lerp_legacy_float(F32& a, bool& a_has_legacy, F32 b, bool b_has_legacy, F32 def, F32 mix)
+{
+ if (b_has_legacy)
{
- if (other->mSettings.has(SETTING_LEGACY_HAZE))
+ if (a_has_legacy)
{
- if (!mSettings.has(SETTING_LEGACY_HAZE) || !mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT))
- {
- // Special case since SETTING_AMBIENT is both in outer and legacy maps, we prioritize legacy one
- // see getAmbientColor(), we are about to replaceSettings(), so we are free to set it
- setAmbientColor(getAmbientColor());
- }
+ a = lerp(a, b, mix);
}
else
{
- if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(SETTING_AMBIENT))
- {
- // Special case due to ambient's duality
- // We need to match 'other's' structure for interpolation.
- // We are free to change mSettings, since we are about to reset it
- mSettings[SETTING_AMBIENT] = getAmbientColor().getValue();
- mSettings[SETTING_LEGACY_HAZE].erase(SETTING_AMBIENT);
- }
+ a = lerp(def, b, mix);
+ a_has_legacy = true;
}
+ }
+ else if (!a_has_legacy)
+ {
+ a = lerp(a, b, mix);
+ }
+ else
+ {
+ a = lerp(a, def, mix);
+ }
+ return a_has_legacy;
+}
+void LLSettingsSky::blend(LLSettingsBase::ptr_t &end, F64 blendf)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
+ llassert(getSettingsType() == end->getSettingsType());
+
+ LLSettingsSky::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast<LLSettingsSky>(end);
+ if (other)
+ {
LLUUID cloud_noise_id = getCloudNoiseTextureId();
LLUUID cloud_noise_id_next = other->getCloudNoiseTextureId();
- F64 cloud_shadow = 0;
if (!cloud_noise_id.isNull() && cloud_noise_id_next.isNull())
{
// If there is no cloud texture in destination, reduce coverage to imitate disappearance
// See LLDrawPoolWLSky::renderSkyClouds... we don't blend present texture with null
// Note: Probably can be done by shader
- cloud_shadow = lerp((F32)mSettings[SETTING_CLOUD_SHADOW].asReal(), 0.f, (F32)blendf);
+ mCloudShadow = lerp(mCloudShadow, 0.f, (F32)blendf);
cloud_noise_id_next = cloud_noise_id;
}
else if (cloud_noise_id.isNull() && !cloud_noise_id_next.isNull())
{
// Source has no cloud texture, reduce initial coverage to imitate appearance
// use same texture as destination
- cloud_shadow = lerp(0.f, (F32)other->mSettings[SETTING_CLOUD_SHADOW].asReal(), (F32)blendf);
+ mCloudShadow = lerp(0.f, mCloudShadow, (F32)blendf);
setCloudNoiseTextureId(cloud_noise_id_next);
}
else
{
- cloud_shadow = lerp((F32)mSettings[SETTING_CLOUD_SHADOW].asReal(), (F32)other->mSettings[SETTING_CLOUD_SHADOW].asReal(), (F32)blendf);
+ mCloudShadow = lerp(mCloudShadow, (F32)other->mCloudShadow, (F32)blendf);
+ }
+
+ mSettingFlags |= other->mSettingFlags;
+
+ mCanAutoAdjust = false; // no point?
+
+ mSunRotation = slerp((F32)blendf, mSunRotation, other->mSunRotation);
+ mMoonRotation = slerp((F32)blendf, mMoonRotation, other->mMoonRotation);
+ lerpColor(mSunlightColor, other->mSunlightColor, (F32)blendf);
+ lerpColor(mGlow, other->mGlow, (F32)blendf);
+ mReflectionProbeAmbiance = lerp(mReflectionProbeAmbiance, other->mReflectionProbeAmbiance, (F32)blendf);
+ mSunScale = lerp(mSunScale, other->mSunScale, (F32)blendf);
+ mStarBrightness = lerp(mStarBrightness, other->mStarBrightness, (F32)blendf);
+ mMoonBrightness = lerp(mMoonBrightness, other->mMoonBrightness, (F32)blendf);
+ mMoonScale = lerp(mMoonScale, other->mMoonScale, (F32)blendf);
+ mMaxY = lerp(mMaxY, other->mMaxY, (F32)blendf);
+ mGamma = lerp(mGamma, other->mGamma, (F32)blendf);
+ mCloudVariance = lerp(mCloudVariance, other->mCloudVariance, (F32)blendf);
+ mCloudShadow = lerp(mCloudShadow, other->mCloudShadow, (F32)blendf);
+ mCloudScale = lerp(mCloudScale, other->mCloudScale, (F32)blendf);
+ lerpVector2(mScrollRate, other->mScrollRate, (F32)blendf);
+ lerpColor(mCloudPosDensity1, other->mCloudPosDensity1, (F32)blendf);
+ lerpColor(mCloudPosDensity2, other->mCloudPosDensity2, (F32)blendf);
+ lerpColor(mCloudColor, other->mCloudColor, (F32)blendf);
+
+ mSunArcRadians = lerp(mSunArcRadians, other->mSunArcRadians, (F32)blendf);
+ mSkyTopRadius = lerp(mSkyTopRadius, other->mSkyTopRadius, (F32)blendf);
+ mSkyBottomRadius = lerp(mSkyBottomRadius, other->mSkyBottomRadius, (F32)blendf);
+ mSkyMoistureLevel = lerp(mSkyMoistureLevel, other->mSkyMoistureLevel, (F32)blendf);
+ mSkyDropletRadius = lerp(mSkyDropletRadius, other->mSkyDropletRadius, (F32)blendf);
+ mSkyIceLevel = lerp(mSkyIceLevel, other->mSkyIceLevel, (F32)blendf);
+ mPlanetRadius = lerp(mPlanetRadius, other->mPlanetRadius, (F32)blendf);
+
+ // Legacy settings
+
+ if (other->mHasLegacyHaze)
+ {
+ if (!mHasLegacyHaze || !mLegacyAmbientColor)
+ {
+ // Special case since SETTING_AMBIENT is both in outer and legacy maps,
+ // we prioritize legacy one
+ setAmbientColor(other->getAmbientColor());
+ mLegacyAmbientColor = true;
+ mHasLegacyHaze = true;
+ }
+ }
+ else
+ {
+ if (mLegacyAmbientColor)
+ {
+ // Special case due to ambient's duality
+ mLegacyAmbientColor = false;
+ }
}
- LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, other->getParameterMap(), blendf);
- blenddata[SETTING_CLOUD_SHADOW] = LLSD::Real(cloud_shadow);
- replaceSettings(blenddata);
+ mHasLegacyHaze |= lerp_legacy_float(mHazeHorizon, mLegacyHazeHorizon, other->mHazeHorizon, other->mLegacyHazeHorizon, 0.19f, (F32)blendf);
+ mHasLegacyHaze |= lerp_legacy_float(mHazeDensity, mLegacyHazeDensity, other->mHazeDensity, other->mLegacyHazeDensity, 0.7f, (F32)blendf);
+ mHasLegacyHaze |= lerp_legacy_float(mDistanceMultiplier, mLegacyDistanceMultiplier, other->mDistanceMultiplier, other->mLegacyDistanceMultiplier, 0.8f, (F32)blendf);
+ mHasLegacyHaze |= lerp_legacy_float(mDensityMultiplier, mLegacyDensityMultiplier, other->mDensityMultiplier, other->mLegacyDensityMultiplier, 0.0001f, (F32)blendf);
+ mHasLegacyHaze |= lerp_legacy_color(mBlueHorizon, mLegacyBlueHorizon, other->mBlueHorizon, other->mLegacyBlueHorizon, LLColor3(0.4954f, 0.4954f, 0.6399f), (F32)blendf);
+ mHasLegacyHaze |= lerp_legacy_color(mBlueDensity, mLegacyBlueDensity, other->mBlueDensity, other->mLegacyBlueDensity, LLColor3(0.2447f, 0.4487f, 0.7599f), (F32)blendf);
+
+ parammapping_t defaults = other->getParameterMap();
+ stringset_t skip = getSkipInterpolateKeys();
+ stringset_t slerps = getSlerpKeys();
+ mAbsorptionConfigs = interpolateSDMap(mAbsorptionConfigs, other->mAbsorptionConfigs, defaults, blendf, skip, slerps);
+ mMieConfigs = interpolateSDMap(mMieConfigs, other->mMieConfigs, defaults, blendf, skip, slerps);
+ mRayleighConfigs = interpolateSDMap(mRayleighConfigs, other->mRayleighConfigs, defaults, blendf, skip, slerps);
+
+ setDirtyFlag(true);
+ setReplaced();
+ setLLSDDirty();
+
mNextSunTextureId = other->getSunTextureId();
mNextMoonTextureId = other->getMoonTextureId();
mNextCloudTextureId = cloud_noise_id_next;
@@ -955,6 +1127,184 @@ void LLSettingsSky::updateSettings()
calculateLightSettings();
}
+
+F32 get_float(bool &use_legacy, LLSD& settings, std::string key, F32 default_value)
+{
+ if (settings.has(LLSettingsSky::SETTING_LEGACY_HAZE) && settings[LLSettingsSky::SETTING_LEGACY_HAZE].has(key))
+ {
+ use_legacy = true;
+ return (F32)settings[LLSettingsSky::SETTING_LEGACY_HAZE][key].asReal();
+ }
+ if (settings.has(key))
+ {
+ return (F32)settings[key].asReal();
+ }
+ use_legacy = true;
+ return default_value;
+}
+
+LLColor3 get_color(bool& use_legacy, LLSD& settings, const std::string& key, const LLColor3& default_value)
+{
+ if (settings.has(LLSettingsSky::SETTING_LEGACY_HAZE) && settings[LLSettingsSky::SETTING_LEGACY_HAZE].has(key))
+ {
+ use_legacy = true;
+ return LLColor3(settings[LLSettingsSky::SETTING_LEGACY_HAZE][key]);
+ }
+ use_legacy = false;
+ if (settings.has(key))
+ {
+ return LLColor3(settings[key]);
+ }
+ use_legacy = true;
+ return default_value;
+}
+
+
+void LLSettingsSky::loadValuesFromLLSD()
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
+
+ LLSettingsBase::loadValuesFromLLSD();
+
+ LLSD& settings = getSettings();
+ mCanAutoAdjust = !settings.has(SETTING_REFLECTION_PROBE_AMBIANCE);
+ if (mCanAutoAdjust)
+ {
+ mReflectionProbeAmbiance = 0;
+ }
+ else
+ {
+ mReflectionProbeAmbiance = (F32)settings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal();
+ }
+
+ mSunTextureId = settings[SETTING_SUN_TEXTUREID].asUUID();
+ mMoonTextureId = settings[SETTING_MOON_TEXTUREID].asUUID();
+ mCloudTextureId = settings[SETTING_CLOUD_TEXTUREID].asUUID();
+ mHaloTextureId = settings[SETTING_HALO_TEXTUREID].asUUID();
+ mRainbowTextureId = settings[SETTING_RAINBOW_TEXTUREID].asUUID();
+ mBloomTextureId = settings[SETTING_BLOOM_TEXTUREID].asUUID();
+
+ mSunScale = (F32)settings[SETTING_SUN_SCALE].asReal();
+ mSunRotation = LLQuaternion(settings[SETTING_SUN_ROTATION]);
+ mSunlightColor = LLColor3(settings[SETTING_SUNLIGHT_COLOR]);
+ mStarBrightness = (F32)settings[SETTING_STAR_BRIGHTNESS].asReal();
+ mMoonBrightness = (F32)settings[SETTING_MOON_BRIGHTNESS].asReal();
+ mMoonScale = (F32)settings[SETTING_MOON_SCALE].asReal();
+ mMoonRotation = LLQuaternion(settings[SETTING_MOON_ROTATION]);
+ mMaxY = (F32)settings[SETTING_MAX_Y].asReal();
+ mGlow = LLColor3(settings[SETTING_GLOW]);
+ mGamma = (F32)settings[SETTING_GAMMA].asReal();
+ mCloudVariance = (F32)settings[SETTING_CLOUD_VARIANCE].asReal();
+ mCloudShadow = (F32)settings[SETTING_CLOUD_SHADOW].asReal();
+ mScrollRate = LLVector2(settings[SETTING_CLOUD_SCROLL_RATE]);
+ mCloudScale = (F32)settings[SETTING_CLOUD_SCALE].asReal();
+ mCloudPosDensity1 = LLColor3(settings[SETTING_CLOUD_POS_DENSITY1]);
+ mCloudPosDensity2 = LLColor3(settings[SETTING_CLOUD_POS_DENSITY2]);
+ mCloudColor = LLColor3(settings[SETTING_CLOUD_COLOR]);
+ mAbsorptionConfigs = settings[SETTING_ABSORPTION_CONFIG];
+ mMieConfigs = settings[SETTING_MIE_CONFIG];
+ mRayleighConfigs = settings[SETTING_RAYLEIGH_CONFIG];
+ mSunArcRadians = (F32)settings[SETTING_SUN_ARC_RADIANS].asReal();
+ mSkyTopRadius = (F32)settings[SETTING_SKY_TOP_RADIUS].asReal();
+ mSkyBottomRadius = (F32)settings[SETTING_SKY_BOTTOM_RADIUS].asReal();
+ mSkyMoistureLevel = (F32)settings[SETTING_SKY_MOISTURE_LEVEL].asReal();
+ mSkyDropletRadius = (F32)settings[SETTING_SKY_DROPLET_RADIUS].asReal();
+ mSkyIceLevel = (F32)settings[SETTING_SKY_ICE_LEVEL].asReal();
+ mPlanetRadius = (F32)settings[SETTING_PLANET_RADIUS].asReal();
+
+ // special case for legacy handling
+ mHasLegacyHaze = settings.has(LLSettingsSky::SETTING_LEGACY_HAZE);
+ mDistanceMultiplier = get_float(mLegacyDistanceMultiplier, settings, SETTING_DISTANCE_MULTIPLIER, 0.8f);
+ mDensityMultiplier = get_float(mLegacyDensityMultiplier, settings, SETTING_DENSITY_MULTIPLIER, 0.0001f);
+ mHazeHorizon = get_float(mLegacyHazeHorizon, settings, SETTING_HAZE_HORIZON, 0.19f);
+ mHazeDensity = get_float(mLegacyHazeDensity, settings, SETTING_HAZE_DENSITY, 0.7f);
+ mBlueHorizon = get_color(mLegacyBlueHorizon, settings, SETTING_BLUE_HORIZON, LLColor3(0.4954f, 0.4954f, 0.6399f));
+ mBlueDensity = get_color(mLegacyBlueDensity, settings, SETTING_BLUE_DENSITY, LLColor3(0.2447f, 0.4487f, 0.7599f));
+ mAmbientColor = get_color(mLegacyAmbientColor, settings, SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f));
+ // one of these values might be true despite not having SETTING_LEGACY_HAZE if defaults were used
+ mHasLegacyHaze |= mLegacyDistanceMultiplier
+ || mLegacyDensityMultiplier
+ || mLegacyHazeHorizon
+ || mLegacyHazeDensity
+ || mLegacyBlueHorizon
+ || mLegacyBlueDensity
+ || mLegacyAmbientColor;
+}
+
+void set_legacy(LLSD &settings, LLSD &legacy, const std::string& key, bool has_value, const LLSD & value)
+{
+ if (has_value)
+ {
+ legacy[key] = value;
+ }
+ else
+ {
+ settings[key] = value;
+ legacy.erase(key);
+ }
+}
+
+void LLSettingsSky::saveValuesToLLSD()
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
+
+ LLSettingsBase::saveValuesToLLSD();
+
+ LLSD& settings = getSettings();
+
+ if (mCanAutoAdjust)
+ {
+ settings.erase(SETTING_REFLECTION_PROBE_AMBIANCE);
+ }
+ else
+ {
+ settings[SETTING_REFLECTION_PROBE_AMBIANCE] = mReflectionProbeAmbiance;
+ }
+ settings[SETTING_SUN_TEXTUREID] = mSunTextureId;
+ settings[SETTING_MOON_TEXTUREID] = mMoonTextureId;
+ settings[SETTING_CLOUD_TEXTUREID] = mCloudTextureId;
+ settings[SETTING_HALO_TEXTUREID] = mHaloTextureId;
+ settings[SETTING_RAINBOW_TEXTUREID] = mRainbowTextureId;
+ settings[SETTING_BLOOM_TEXTUREID] = mBloomTextureId;
+
+ settings[SETTING_SUN_SCALE] = mSunScale;
+ settings[SETTING_SUN_ROTATION] = mSunRotation.getValue();
+ settings[SETTING_SUNLIGHT_COLOR] = mSunlightColor.getValue();
+ settings[SETTING_STAR_BRIGHTNESS] = mStarBrightness;
+ settings[SETTING_MOON_BRIGHTNESS] = mMoonBrightness;
+ settings[SETTING_MOON_SCALE] = mMoonScale;
+ settings[SETTING_MOON_ROTATION] = mMoonRotation.getValue();
+ settings[SETTING_MAX_Y] = mMaxY;
+ settings[SETTING_GLOW] = mGlow.getValue();
+ settings[SETTING_GAMMA] = mGamma;
+ settings[SETTING_CLOUD_VARIANCE] = mCloudVariance;
+ settings[SETTING_CLOUD_SHADOW] = mCloudShadow;
+ settings[SETTING_CLOUD_SCROLL_RATE] = mScrollRate.getValue();
+ settings[SETTING_CLOUD_SCALE] = mCloudScale;
+ settings[SETTING_CLOUD_POS_DENSITY1] = mCloudPosDensity1.getValue();
+ settings[SETTING_CLOUD_POS_DENSITY2] = mCloudPosDensity2.getValue();
+ settings[SETTING_CLOUD_COLOR] = mCloudColor.getValue();
+ settings[SETTING_ABSORPTION_CONFIG] = mAbsorptionConfigs;
+ settings[SETTING_MIE_CONFIG] = mMieConfigs;
+ settings[SETTING_RAYLEIGH_CONFIG] = mRayleighConfigs;
+ settings[SETTING_SUN_ARC_RADIANS] = mSunArcRadians;
+ settings[SETTING_SKY_TOP_RADIUS] = mSkyTopRadius;
+ settings[SETTING_SKY_BOTTOM_RADIUS] = mSkyBottomRadius;
+ settings[SETTING_SKY_MOISTURE_LEVEL] = mSkyMoistureLevel;
+ settings[SETTING_SKY_DROPLET_RADIUS] = mSkyDropletRadius;
+ settings[SETTING_SKY_ICE_LEVEL] = mSkyIceLevel;
+ settings[SETTING_PLANET_RADIUS] = mPlanetRadius;
+
+ LLSD& legacy = settings[SETTING_LEGACY_HAZE];
+ set_legacy(settings, legacy, SETTING_DISTANCE_MULTIPLIER, mLegacyDistanceMultiplier, LLSD::Real(mDistanceMultiplier));
+ set_legacy(settings, legacy, SETTING_DENSITY_MULTIPLIER, mLegacyDensityMultiplier, LLSD::Real(mDensityMultiplier));
+ set_legacy(settings, legacy, SETTING_HAZE_HORIZON, mLegacyHazeHorizon, LLSD::Real(mHazeHorizon));
+ set_legacy(settings, legacy, SETTING_HAZE_DENSITY, mLegacyHazeDensity, LLSD::Real(mHazeDensity));
+ set_legacy(settings, legacy, SETTING_BLUE_HORIZON, mLegacyBlueHorizon, mBlueHorizon.getValue());
+ set_legacy(settings, legacy, SETTING_BLUE_DENSITY, mLegacyBlueDensity, mBlueDensity.getValue());
+ set_legacy(settings, legacy, SETTING_AMBIENT, mLegacyAmbientColor, mAmbientColor.getValue());
+}
+
F32 LLSettingsSky::getSunMoonGlowFactor() const
{
return getIsSunUp() ? 1.0f :
@@ -1024,37 +1374,40 @@ LLColor3 LLSettingsSky::getLightDiffuse() const
return LLColor3::white;
}
-LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default_value) const
+LLColor3 LLSettingsSky::getColor(const std::string& key, const LLColor3& default_value)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
- if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key))
+ LLSD& settings = getSettings();
+ if (settings.has(SETTING_LEGACY_HAZE) && settings[SETTING_LEGACY_HAZE].has(key))
{
- return LLColor3(mSettings[SETTING_LEGACY_HAZE][key]);
+ return LLColor3(settings[SETTING_LEGACY_HAZE][key]);
}
- if (mSettings.has(key))
+ if (settings.has(key))
{
- return LLColor3(mSettings[key]);
+ return LLColor3(settings[key]);
}
return default_value;
}
-F32 LLSettingsSky::getFloat(const std::string& key, F32 default_value) const
+F32 LLSettingsSky::getFloat(const std::string& key, F32 default_value)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
- if (mSettings.has(SETTING_LEGACY_HAZE) && mSettings[SETTING_LEGACY_HAZE].has(key))
+
+ LLSD& settings = getSettings();
+ if (settings.has(SETTING_LEGACY_HAZE) && settings[SETTING_LEGACY_HAZE].has(key))
{
- return (F32)mSettings[SETTING_LEGACY_HAZE][key].asReal();
+ return (F32)settings[SETTING_LEGACY_HAZE][key].asReal();
}
- if (mSettings.has(key))
+ if (settings.has(key))
{
- return (F32)mSettings[key].asReal();
+ return (F32)settings[key].asReal();
}
return default_value;
}
LLColor3 LLSettingsSky::getAmbientColor() const
{
- return getColor(SETTING_AMBIENT, LLColor3(0.25f, 0.25f, 0.25f));
+ return mAmbientColor;
}
LLColor3 LLSettingsSky::getAmbientColorClamped() const
@@ -1072,119 +1425,143 @@ LLColor3 LLSettingsSky::getAmbientColorClamped() const
LLColor3 LLSettingsSky::getBlueDensity() const
{
- return getColor(SETTING_BLUE_DENSITY, LLColor3(0.2447f, 0.4487f, 0.7599f));
+ return mBlueDensity;
}
LLColor3 LLSettingsSky::getBlueHorizon() const
{
- return getColor(SETTING_BLUE_HORIZON, LLColor3(0.4954f, 0.4954f, 0.6399f));
+ return mBlueHorizon;
}
F32 LLSettingsSky::getHazeDensity() const
{
- return getFloat(SETTING_HAZE_DENSITY, 0.7f);
+ return mHazeDensity;
}
F32 LLSettingsSky::getHazeHorizon() const
{
- return getFloat(SETTING_HAZE_HORIZON, 0.19f);
+ return mHazeHorizon;
}
F32 LLSettingsSky::getDensityMultiplier() const
{
- return getFloat(SETTING_DENSITY_MULTIPLIER, 0.0001f);
+ return mDensityMultiplier;
}
F32 LLSettingsSky::getDistanceMultiplier() const
{
- return getFloat(SETTING_DISTANCE_MULTIPLIER, 0.8f);
+ return mDistanceMultiplier;
}
void LLSettingsSky::setPlanetRadius(F32 radius)
{
- mSettings[SETTING_PLANET_RADIUS] = radius;
+ mPlanetRadius = radius;
+ setDirtyFlag(true);
}
void LLSettingsSky::setSkyBottomRadius(F32 radius)
{
- mSettings[SETTING_SKY_BOTTOM_RADIUS] = radius;
+ mSkyBottomRadius = radius;
+ setDirtyFlag(true);
}
void LLSettingsSky::setSkyTopRadius(F32 radius)
{
- mSettings[SETTING_SKY_TOP_RADIUS] = radius;
+ mSkyTopRadius = radius;
+ setDirtyFlag(true);
}
void LLSettingsSky::setSunArcRadians(F32 radians)
{
- mSettings[SETTING_SUN_ARC_RADIANS] = radians;
+ mSunArcRadians = radians;
+ setDirtyFlag(true);
}
void LLSettingsSky::setMieAnisotropy(F32 aniso_factor)
{
getMieConfig()[SETTING_MIE_ANISOTROPY_FACTOR] = aniso_factor;
+ setDirtyFlag(true);
}
void LLSettingsSky::setSkyMoistureLevel(F32 moisture_level)
{
- setValue(SETTING_SKY_MOISTURE_LEVEL, moisture_level);
+ mSkyMoistureLevel = moisture_level;
+ setDirtyFlag(true);
}
void LLSettingsSky::setSkyDropletRadius(F32 radius)
{
- setValue(SETTING_SKY_DROPLET_RADIUS,radius);
+ mSkyDropletRadius = radius;
+ setDirtyFlag(true);
}
void LLSettingsSky::setSkyIceLevel(F32 ice_level)
{
- setValue(SETTING_SKY_ICE_LEVEL, ice_level);
+ mSkyIceLevel = ice_level;
+ setDirtyFlag(true);
}
void LLSettingsSky::setReflectionProbeAmbiance(F32 ambiance)
{
- setValue(SETTING_REFLECTION_PROBE_AMBIANCE, ambiance);
+ mReflectionProbeAmbiance = ambiance;
+ mCanAutoAdjust = false;
+ setLLSDDirty();
}
void LLSettingsSky::setAmbientColor(const LLColor3 &val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_AMBIENT] = val.getValue();
+ mAmbientColor = val;
+ mLegacyAmbientColor = true;
setDirtyFlag(true);
+ setLLSDDirty();
}
void LLSettingsSky::setBlueDensity(const LLColor3 &val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_DENSITY] = val.getValue();
+ mBlueDensity = val;
+ mLegacyBlueDensity = true;
setDirtyFlag(true);
+ setLLSDDirty();
}
void LLSettingsSky::setBlueHorizon(const LLColor3 &val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_BLUE_HORIZON] = val.getValue();
+ mBlueHorizon = val;
+ mLegacyBlueHorizon = true;
setDirtyFlag(true);
+ setLLSDDirty();
}
void LLSettingsSky::setDensityMultiplier(F32 val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_DENSITY_MULTIPLIER] = val;
+ mDensityMultiplier = val;
+ mLegacyDensityMultiplier = true;
setDirtyFlag(true);
+ setLLSDDirty();
}
void LLSettingsSky::setDistanceMultiplier(F32 val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_DISTANCE_MULTIPLIER] = val;
+ mDistanceMultiplier = val;
+ mLegacyDistanceMultiplier = true;
setDirtyFlag(true);
+ setLLSDDirty();
}
void LLSettingsSky::setHazeDensity(F32 val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_DENSITY] = val;
+ mHazeDensity = val;
+ mLegacyHazeDensity = true;
setDirtyFlag(true);
+ setLLSDDirty();
}
void LLSettingsSky::setHazeHorizon(F32 val)
{
- mSettings[SETTING_LEGACY_HAZE][SETTING_HAZE_HORIZON] = val;
+ mHazeHorizon = val;
+ mLegacyHazeHorizon = true;
setDirtyFlag(true);
+ setLLSDDirty();
}
// Get total from rayleigh and mie density values for normalization
@@ -1299,7 +1676,7 @@ LLColor3 LLSettingsSky::getMoonlightColor() const
return getSunlightColor(); //moon and sun share light color
}
-void LLSettingsSky::clampColor(LLColor3& color, F32 gamma, F32 scale) const
+void LLSettingsSky::clampColor(LLColor3& color, F32 gamma, F32 scale)
{
F32 max_color = llmax(color.mV[0], color.mV[1], color.mV[2]);
if (max_color > scale)
@@ -1415,22 +1792,22 @@ LLUUID LLSettingsSky::GetDefaultHaloTextureId()
F32 LLSettingsSky::getPlanetRadius() const
{
- return (F32)mSettings[SETTING_PLANET_RADIUS].asReal();
+ return mPlanetRadius;
}
F32 LLSettingsSky::getSkyMoistureLevel() const
{
- return (F32)mSettings[SETTING_SKY_MOISTURE_LEVEL].asReal();
+ return mSkyMoistureLevel;
}
F32 LLSettingsSky::getSkyDropletRadius() const
{
- return (F32)mSettings[SETTING_SKY_DROPLET_RADIUS].asReal();
+ return mSkyDropletRadius;
}
F32 LLSettingsSky::getSkyIceLevel() const
{
- return (F32)mSettings[SETTING_SKY_ICE_LEVEL].asReal();
+ return mSkyIceLevel;
}
F32 LLSettingsSky::getReflectionProbeAmbiance(bool auto_adjust) const
@@ -1440,22 +1817,22 @@ F32 LLSettingsSky::getReflectionProbeAmbiance(bool auto_adjust) const
return sAutoAdjustProbeAmbiance;
}
- return (F32)mSettings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal();
+ return mReflectionProbeAmbiance;
}
F32 LLSettingsSky::getSkyBottomRadius() const
{
- return (F32)mSettings[SETTING_SKY_BOTTOM_RADIUS].asReal();
+ return mSkyBottomRadius;
}
F32 LLSettingsSky::getSkyTopRadius() const
{
- return (F32)mSettings[SETTING_SKY_TOP_RADIUS].asReal();
+ return mSkyTopRadius;
}
F32 LLSettingsSky::getSunArcRadians() const
{
- return (F32)mSettings[SETTING_SUN_ARC_RADIANS].asReal();
+ return mSunArcRadians;
}
F32 LLSettingsSky::getMieAnisotropy() const
@@ -1465,158 +1842,171 @@ F32 LLSettingsSky::getMieAnisotropy() const
LLSD LLSettingsSky::getRayleighConfig() const
{
- LLSD copy = *(mSettings[SETTING_RAYLEIGH_CONFIG].beginArray());
+ LLSD copy = *(mRayleighConfigs.beginArray());
return copy;
}
LLSD LLSettingsSky::getMieConfig() const
{
- LLSD copy = *(mSettings[SETTING_MIE_CONFIG].beginArray());
+ LLSD copy = *(mMieConfigs.beginArray());
return copy;
}
LLSD LLSettingsSky::getAbsorptionConfig() const
{
- LLSD copy = *(mSettings[SETTING_ABSORPTION_CONFIG].beginArray());
+ LLSD copy = *(mAbsorptionConfigs.beginArray());
return copy;
}
LLSD LLSettingsSky::getRayleighConfigs() const
{
- return mSettings[SETTING_RAYLEIGH_CONFIG];
+ return mRayleighConfigs;
}
LLSD LLSettingsSky::getMieConfigs() const
{
- return mSettings[SETTING_MIE_CONFIG];
+ return mMieConfigs;
}
LLSD LLSettingsSky::getAbsorptionConfigs() const
{
- return mSettings[SETTING_ABSORPTION_CONFIG];
+ return mAbsorptionConfigs;
}
void LLSettingsSky::setRayleighConfigs(const LLSD& rayleighConfig)
{
- mSettings[SETTING_RAYLEIGH_CONFIG] = rayleighConfig;
+ mRayleighConfigs = rayleighConfig;
+ setLLSDDirty();
}
void LLSettingsSky::setMieConfigs(const LLSD& mieConfig)
{
- mSettings[SETTING_MIE_CONFIG] = mieConfig;
+ mMieConfigs = mieConfig;
+ setLLSDDirty();
}
void LLSettingsSky::setAbsorptionConfigs(const LLSD& absorptionConfig)
{
- mSettings[SETTING_ABSORPTION_CONFIG] = absorptionConfig;
+ mAbsorptionConfigs = absorptionConfig;
+ setLLSDDirty();
}
LLUUID LLSettingsSky::getBloomTextureId() const
{
- return mSettings[SETTING_BLOOM_TEXTUREID].asUUID();
+ return mBloomTextureId;
}
LLUUID LLSettingsSky::getRainbowTextureId() const
{
- return mSettings[SETTING_RAINBOW_TEXTUREID].asUUID();
+ return mRainbowTextureId;
}
LLUUID LLSettingsSky::getHaloTextureId() const
{
- return mSettings[SETTING_HALO_TEXTUREID].asUUID();
+ return mHaloTextureId;
}
//---------------------------------------------------------------------
LLColor3 LLSettingsSky::getCloudColor() const
{
- return LLColor3(mSettings[SETTING_CLOUD_COLOR]);
+ return mCloudColor;
}
void LLSettingsSky::setCloudColor(const LLColor3 &val)
{
- setValue(SETTING_CLOUD_COLOR, val);
+ mCloudColor = val;
+ setLLSDDirty();
}
LLUUID LLSettingsSky::getCloudNoiseTextureId() const
{
- return mSettings[SETTING_CLOUD_TEXTUREID].asUUID();
+ return mCloudTextureId;
}
void LLSettingsSky::setCloudNoiseTextureId(const LLUUID &id)
{
- setValue(SETTING_CLOUD_TEXTUREID, id);
+ mCloudTextureId = id;
+ setLLSDDirty();
}
LLColor3 LLSettingsSky::getCloudPosDensity1() const
{
- return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY1]);
+ return mCloudPosDensity1;
}
void LLSettingsSky::setCloudPosDensity1(const LLColor3 &val)
{
- setValue(SETTING_CLOUD_POS_DENSITY1, val);
+ mCloudPosDensity1 = val;
+ setLLSDDirty();
}
LLColor3 LLSettingsSky::getCloudPosDensity2() const
{
- return LLColor3(mSettings[SETTING_CLOUD_POS_DENSITY2]);
+ return mCloudPosDensity2;
}
void LLSettingsSky::setCloudPosDensity2(const LLColor3 &val)
{
- setValue(SETTING_CLOUD_POS_DENSITY2, val);
+ mCloudPosDensity2 = val;
+ setLLSDDirty();
}
F32 LLSettingsSky::getCloudScale() const
{
- return (F32)mSettings[SETTING_CLOUD_SCALE].asReal();
+ return mCloudScale;
}
void LLSettingsSky::setCloudScale(F32 val)
{
- setValue(SETTING_CLOUD_SCALE, val);
+ mCloudScale = val;
+ setLLSDDirty();
}
LLVector2 LLSettingsSky::getCloudScrollRate() const
{
- return LLVector2(mSettings[SETTING_CLOUD_SCROLL_RATE]);
+ return mScrollRate;
}
void LLSettingsSky::setCloudScrollRate(const LLVector2 &val)
{
- setValue(SETTING_CLOUD_SCROLL_RATE, val);
+ mScrollRate = val;
+ setLLSDDirty();
}
void LLSettingsSky::setCloudScrollRateX(F32 val)
{
- mSettings[SETTING_CLOUD_SCROLL_RATE][0] = val;
+ mScrollRate.mV[0] = val;
setDirtyFlag(true);
+ setLLSDDirty();
}
void LLSettingsSky::setCloudScrollRateY(F32 val)
{
- mSettings[SETTING_CLOUD_SCROLL_RATE][1] = val;
+ mScrollRate.mV[1] = val;
setDirtyFlag(true);
+ setLLSDDirty();
}
F32 LLSettingsSky::getCloudShadow() const
{
- return (F32)mSettings[SETTING_CLOUD_SHADOW].asReal();
+ return mCloudShadow;
}
void LLSettingsSky::setCloudShadow(F32 val)
{
- setValue(SETTING_CLOUD_SHADOW, val);
+ mCloudShadow = val;
+ setLLSDDirty();
}
F32 LLSettingsSky::getCloudVariance() const
{
- return (F32)mSettings[SETTING_CLOUD_VARIANCE].asReal();
+ return mCloudVariance;
}
void LLSettingsSky::setCloudVariance(F32 val)
{
- setValue(SETTING_CLOUD_VARIANCE, val);
+ mCloudVariance = val;
+ setLLSDDirty();
}
F32 LLSettingsSky::getDomeOffset() const
@@ -1633,88 +2023,95 @@ F32 LLSettingsSky::getDomeRadius() const
F32 LLSettingsSky::getGamma() const
{
- return (F32)mSettings[SETTING_GAMMA].asReal();
+ return mGamma;
}
void LLSettingsSky::setGamma(F32 val)
{
- mSettings[SETTING_GAMMA] = LLSD::Real(val);
+ mGamma = val;
setDirtyFlag(true);
+ setLLSDDirty();
}
-
LLColor3 LLSettingsSky::getGlow() const
{
- return LLColor3(mSettings[SETTING_GLOW]);
+ return mGlow;
}
void LLSettingsSky::setGlow(const LLColor3 &val)
{
- setValue(SETTING_GLOW, val);
+ mGlow = val;
+ setLLSDDirty();
}
F32 LLSettingsSky::getMaxY() const
{
- return (F32)mSettings[SETTING_MAX_Y].asReal();
+ return mMaxY;
}
void LLSettingsSky::setMaxY(F32 val)
{
- setValue(SETTING_MAX_Y, val);
+ mMaxY = val;
+ setLLSDDirty();
}
LLQuaternion LLSettingsSky::getMoonRotation() const
{
- return LLQuaternion(mSettings[SETTING_MOON_ROTATION]);
+ return mMoonRotation;
}
void LLSettingsSky::setMoonRotation(const LLQuaternion &val)
{
- setValue(SETTING_MOON_ROTATION, val);
+ mMoonRotation = val;
+ setLLSDDirty();
}
F32 LLSettingsSky::getMoonScale() const
{
- return (F32)mSettings[SETTING_MOON_SCALE].asReal();
+ return mMoonScale;
}
void LLSettingsSky::setMoonScale(F32 val)
{
- setValue(SETTING_MOON_SCALE, val);
+ mMoonScale = val;
+ setLLSDDirty();
}
LLUUID LLSettingsSky::getMoonTextureId() const
{
- return mSettings[SETTING_MOON_TEXTUREID].asUUID();
+ return mMoonTextureId;
}
void LLSettingsSky::setMoonTextureId(LLUUID id)
{
- setValue(SETTING_MOON_TEXTUREID, id);
+ mMoonTextureId = id;
+ setLLSDDirty();
}
F32 LLSettingsSky::getMoonBrightness() const
{
- return (F32)mSettings[SETTING_MOON_BRIGHTNESS].asReal();
+ return mMoonBrightness;
}
void LLSettingsSky::setMoonBrightness(F32 brightness_factor)
{
- setValue(SETTING_MOON_BRIGHTNESS, brightness_factor);
+ mMoonBrightness = brightness_factor;
+ setLLSDDirty();
}
F32 LLSettingsSky::getStarBrightness() const
{
- return (F32)mSettings[SETTING_STAR_BRIGHTNESS].asReal();
+ return mStarBrightness;
}
void LLSettingsSky::setStarBrightness(F32 val)
{
- setValue(SETTING_STAR_BRIGHTNESS, val);
+ mStarBrightness = val;
+ setLLSDDirty();
}
LLColor3 LLSettingsSky::getSunlightColor() const
{
- return LLColor3(mSettings[SETTING_SUNLIGHT_COLOR]);
+ return mSunlightColor;
}
LLColor3 LLSettingsSky::getSunlightColorClamped() const
@@ -1733,38 +2130,41 @@ LLColor3 LLSettingsSky::getSunlightColorClamped() const
void LLSettingsSky::setSunlightColor(const LLColor3 &val)
{
- setValue(SETTING_SUNLIGHT_COLOR, val);
+ mSunlightColor = val;
+ setLLSDDirty();
}
LLQuaternion LLSettingsSky::getSunRotation() const
{
- return LLQuaternion(mSettings[SETTING_SUN_ROTATION]);
+ return mSunRotation;
}
void LLSettingsSky::setSunRotation(const LLQuaternion &val)
{
- setValue(SETTING_SUN_ROTATION, val);
+ mSunRotation = val;
+ setLLSDDirty();
}
-
F32 LLSettingsSky::getSunScale() const
{
- return (F32)mSettings[SETTING_SUN_SCALE].asReal();
+ return mSunScale;
}
void LLSettingsSky::setSunScale(F32 val)
{
- setValue(SETTING_SUN_SCALE, val);
+ mSunScale = val;
+ setLLSDDirty();
}
LLUUID LLSettingsSky::getSunTextureId() const
{
- return mSettings[SETTING_SUN_TEXTUREID].asUUID();
+ return mSunTextureId;
}
void LLSettingsSky::setSunTextureId(LLUUID id)
{
- setValue(SETTING_SUN_TEXTUREID, id);
+ mSunTextureId = id;
+ setLLSDDirty();
}
LLUUID LLSettingsSky::getNextSunTextureId() const
@@ -1790,5 +2190,5 @@ LLUUID LLSettingsSky::getNextBloomTextureId() const
// if true, this sky is a candidate for auto-adjustment
bool LLSettingsSky::canAutoAdjust() const
{
- return !mSettings.has(SETTING_REFLECTION_PROBE_AMBIANCE);
+ return mCanAutoAdjust;
}
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index 40bb337a48..38c0368423 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -111,20 +111,24 @@ public:
LLSettingsSky(const LLSD &data);
virtual ~LLSettingsSky() { };
- virtual ptr_t buildClone() const = 0;
+ virtual ptr_t buildClone() = 0;
//---------------------------------------------------------------------
virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("sky"); }
virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_SKY; }
// Settings status
- virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
+ virtual void blend(LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE;
+ virtual void replaceSettings(const LLSettingsBase::ptr_t& other_sky) override;
- void replaceWithSky(LLSettingsSky::ptr_t pother);
+ void replaceWithSky(const LLSettingsSky::ptr_t& pother);
static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f);
+ void loadValuesFromLLSD() override;
+ void saveValuesToLLSD() override;
+
F32 getPlanetRadius() const;
F32 getSkyBottomRadius() const;
F32 getSkyTopRadius() const;
@@ -306,7 +310,7 @@ public:
LLColor3 getSunlightColorClamped() const;
LLColor3 getAmbientColorClamped() const;
- virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); }
+ virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
static LLUUID GetDefaultAssetId();
static LLUUID GetDefaultSunTextureId();
@@ -348,6 +352,12 @@ protected:
virtual stringset_t getSlerpKeys() const SETTINGS_OVERRIDE;
virtual stringset_t getSkipInterpolateKeys() const SETTINGS_OVERRIDE;
+ LLUUID mSunTextureId;
+ LLUUID mMoonTextureId;
+ LLUUID mCloudTextureId;
+ LLUUID mBloomTextureId;
+ LLUUID mRainbowTextureId;
+ LLUUID mHaloTextureId;
LLUUID mNextSunTextureId;
LLUUID mNextMoonTextureId;
LLUUID mNextCloudTextureId;
@@ -355,17 +365,64 @@ protected:
LLUUID mNextRainbowTextureId;
LLUUID mNextHaloTextureId;
+ bool mCanAutoAdjust;
+ LLQuaternion mSunRotation;
+ LLQuaternion mMoonRotation;
+ LLColor3 mSunlightColor;
+ LLColor3 mGlow;
+ F32 mReflectionProbeAmbiance;
+ F32 mSunScale;
+ F32 mStarBrightness;
+ F32 mMoonBrightness;
+ F32 mMoonScale;
+ F32 mMaxY;
+ F32 mGamma;
+ F32 mCloudVariance;
+ F32 mCloudShadow;
+ F32 mCloudScale;
+ LLVector2 mScrollRate;
+ LLColor3 mCloudPosDensity1;
+ LLColor3 mCloudPosDensity2;
+ LLColor3 mCloudColor;
+ LLSD mAbsorptionConfigs;
+ LLSD mMieConfigs;
+ LLSD mRayleighConfigs;
+ F32 mSunArcRadians;
+ F32 mSkyTopRadius;
+ F32 mSkyBottomRadius;
+ F32 mSkyMoistureLevel;
+ F32 mSkyDropletRadius;
+ F32 mSkyIceLevel;
+ F32 mPlanetRadius;
+
+ F32 mHazeHorizon;
+ F32 mHazeDensity;
+ F32 mDistanceMultiplier;
+ F32 mDensityMultiplier;
+ LLColor3 mBlueHorizon;
+ LLColor3 mBlueDensity;
+ LLColor3 mAmbientColor;
+
+ bool mHasLegacyHaze;
+ bool mLegacyHazeHorizon;
+ bool mLegacyHazeDensity;
+ bool mLegacyDistanceMultiplier;
+ bool mLegacyDensityMultiplier;
+ bool mLegacyBlueHorizon;
+ bool mLegacyBlueDensity;
+ bool mLegacyAmbientColor;
+
private:
static LLSD rayleighConfigDefault();
static LLSD absorptionConfigDefault();
static LLSD mieConfigDefault();
- LLColor3 getColor(const std::string& key, const LLColor3& default_value) const;
- F32 getFloat(const std::string& key, F32 default_value) const;
+ LLColor3 getColor(const std::string& key, const LLColor3& default_value);
+ F32 getFloat(const std::string& key, F32 default_value);
void calculateHeavenlyBodyPositions() const;
void calculateLightSettings() const;
- void clampColor(LLColor3& color, F32 gamma, const F32 scale = 1.0f) const;
+ static void clampColor(LLColor3& color, F32 gamma, const F32 scale = 1.0f);
mutable LLVector3 mSunDirection;
mutable LLVector3 mMoonDirection;
diff --git a/indra/llinventory/llsettingswater.cpp b/indra/llinventory/llsettingswater.cpp
index 161b8cda25..08e18ea26e 100644
--- a/indra/llinventory/llsettingswater.cpp
+++ b/indra/llinventory/llsettingswater.cpp
@@ -68,14 +68,18 @@ static const LLUUID DEFAULT_OPAQUE_WATER_TEXTURE("43c32285-d658-1793-c123-bf8631
//=========================================================================
LLSettingsWater::LLSettingsWater(const LLSD &data) :
LLSettingsBase(data),
- mNextNormalMapID()
+ mNextNormalMapID(),
+ mNextTransparentTextureID()
{
+ loadValuesFromLLSD();
}
LLSettingsWater::LLSettingsWater() :
LLSettingsBase(),
- mNextNormalMapID()
+ mNextNormalMapID(),
+ mNextTransparentTextureID()
{
+ replaceSettings(defaults());
}
//=========================================================================
@@ -109,6 +113,53 @@ LLSD LLSettingsWater::defaults(const LLSettingsBase::TrackPosition& position)
return dfltsetting;
}
+void LLSettingsWater::loadValuesFromLLSD()
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
+
+ LLSettingsBase::loadValuesFromLLSD();
+
+ LLSD& settings = getSettings();
+
+ mBlurMultiplier = (F32)settings[SETTING_BLUR_MULTIPLIER].asReal();
+ mWaterFogColor = LLColor3(settings[SETTING_FOG_COLOR]);
+ mWaterFogDensity = (F32)settings[SETTING_FOG_DENSITY].asReal();
+ mFogMod = (F32)settings[SETTING_FOG_MOD].asReal();
+ mFresnelOffset = (F32)settings[SETTING_FRESNEL_OFFSET].asReal();
+ mFresnelScale = (F32)settings[SETTING_FRESNEL_SCALE].asReal();
+ mNormalScale = LLVector3(settings[SETTING_NORMAL_SCALE]);
+ mScaleAbove = (F32)settings[SETTING_SCALE_ABOVE].asReal();
+ mScaleBelow = (F32)settings[SETTING_SCALE_BELOW].asReal();
+ mWave1Dir = LLVector2(settings[SETTING_WAVE1_DIR]);
+ mWave2Dir = LLVector2(settings[SETTING_WAVE2_DIR]);
+
+ mNormalMapID = getNormalMapID();
+ mTransparentTextureID = getTransparentTextureID();
+}
+
+void LLSettingsWater::saveValuesToLLSD()
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
+
+ LLSettingsBase::saveValuesToLLSD();
+
+ LLSD & settings = getSettings();
+ settings[SETTING_BLUR_MULTIPLIER] = LLSD::Real(mBlurMultiplier);
+ settings[SETTING_FOG_COLOR] = mWaterFogColor.getValue();
+ settings[SETTING_FOG_DENSITY] = LLSD::Real(mWaterFogDensity);
+ settings[SETTING_FOG_MOD] = LLSD::Real(mFogMod);
+ settings[SETTING_FRESNEL_OFFSET] = LLSD::Real(mFresnelOffset);
+ settings[SETTING_FRESNEL_SCALE] = LLSD::Real(mFresnelScale);
+ settings[SETTING_NORMAL_SCALE] = mNormalScale.getValue();
+ settings[SETTING_SCALE_ABOVE] = LLSD::Real(mScaleAbove);
+ settings[SETTING_SCALE_BELOW] = LLSD::Real(mScaleBelow);
+ settings[SETTING_WAVE1_DIR] = mWave1Dir.getValue();
+ settings[SETTING_WAVE2_DIR] = mWave2Dir.getValue();
+
+ settings[SETTING_NORMAL_MAP] = mNormalMapID;
+ settings[SETTING_TRANSPARENT_TEXTURE] = mTransparentTextureID;
+}
+
LLSD LLSettingsWater::translateLegacySettings(LLSD legacy)
{
bool converted_something(false);
@@ -180,13 +231,30 @@ LLSD LLSettingsWater::translateLegacySettings(LLSD legacy)
return newsettings;
}
-void LLSettingsWater::blend(const LLSettingsBase::ptr_t &end, F64 blendf)
+void LLSettingsWater::blend(LLSettingsBase::ptr_t &end, F64 blendf)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_ENVIRONMENT;
LLSettingsWater::ptr_t other = PTR_NAMESPACE::static_pointer_cast<LLSettingsWater>(end);
if (other)
{
- LLSD blenddata = interpolateSDMap(mSettings, other->mSettings, other->getParameterMap(), blendf);
- replaceSettings(blenddata);
+ mSettingFlags |= other->mSettingFlags;
+
+ mBlurMultiplier = lerp((F32)blendf, mBlurMultiplier, other->mBlurMultiplier);
+ lerpColor(mWaterFogColor, other->mWaterFogColor, (F32)blendf);
+ mWaterFogDensity = lerp((F32)blendf, mWaterFogDensity, other->mWaterFogDensity);
+ mFogMod = lerp((F32)blendf, mFogMod, other->mFogMod);
+ mFresnelOffset = lerp((F32)blendf, mFresnelOffset, other->mFresnelOffset);
+ mFresnelScale = lerp((F32)blendf, mFresnelScale, other->mFresnelScale);
+ lerpVector3(mNormalScale, other->mNormalScale, (F32)blendf);
+ mScaleAbove = lerp((F32)blendf, mScaleAbove, other->mScaleAbove);
+ mScaleBelow = lerp((F32)blendf, mScaleBelow, other->mScaleBelow);
+ lerpVector2(mWave1Dir, other->mWave1Dir, (F32)blendf);
+ lerpVector2(mWave2Dir, other->mWave2Dir, (F32)blendf);
+
+ setDirtyFlag(true);
+ setReplaced();
+ setLLSDDirty();
+
mNextNormalMapID = other->getNormalMapID();
mNextTransparentTextureID = other->getTransparentTextureID();
}
@@ -204,7 +272,34 @@ void LLSettingsWater::replaceSettings(LLSD settings)
mNextTransparentTextureID.setNull();
}
-void LLSettingsWater::replaceWithWater(LLSettingsWater::ptr_t other)
+void LLSettingsWater::replaceSettings(const LLSettingsBase::ptr_t& other_water)
+{
+ LLSettingsBase::replaceSettings(other_water);
+
+ llassert(getSettingsType() == other_water->getSettingsType());
+
+ LLSettingsWater::ptr_t other = PTR_NAMESPACE::dynamic_pointer_cast<LLSettingsWater>(other_water);
+
+ mBlurMultiplier = other->mBlurMultiplier;
+ mWaterFogColor = other->mWaterFogColor;
+ mWaterFogDensity = other->mWaterFogDensity;
+ mFogMod = other->mFogMod;
+ mFresnelOffset = other->mFresnelOffset;
+ mFresnelScale = other->mFresnelScale;
+ mNormalScale = other->mNormalScale;
+ mScaleAbove = other->mScaleAbove;
+ mScaleBelow = other->mScaleBelow;
+ mWave1Dir = other->mWave1Dir;
+ mWave2Dir = other->mWave2Dir;
+
+ mNormalMapID = other->mNormalMapID;
+ mTransparentTextureID = other->mTransparentTextureID;
+
+ mNextNormalMapID.setNull();
+ mNextTransparentTextureID.setNull();
+}
+
+void LLSettingsWater::replaceWithWater(const LLSettingsWater::ptr_t& other)
{
replaceWith(other);
diff --git a/indra/llinventory/llsettingswater.h b/indra/llinventory/llsettingswater.h
index 9e7ff61272..82fc37cfb3 100644
--- a/indra/llinventory/llsettingswater.h
+++ b/indra/llinventory/llsettingswater.h
@@ -55,151 +55,181 @@ public:
LLSettingsWater(const LLSD &data);
virtual ~LLSettingsWater() { };
- virtual ptr_t buildClone() const = 0;
+ virtual ptr_t buildClone() = 0;
//---------------------------------------------------------------------
virtual std::string getSettingsType() const SETTINGS_OVERRIDE { return std::string("water"); }
virtual LLSettingsType::type_e getSettingsTypeValue() const SETTINGS_OVERRIDE { return LLSettingsType::ST_WATER; }
// Settings status
- virtual void blend(const LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
+ virtual void blend(LLSettingsBase::ptr_t &end, F64 blendf) SETTINGS_OVERRIDE;
virtual void replaceSettings(LLSD settings) SETTINGS_OVERRIDE;
- void replaceWithWater(LLSettingsWater::ptr_t other);
+ virtual void replaceSettings(const LLSettingsBase::ptr_t& other_water) override;
+ void replaceWithWater(const LLSettingsWater::ptr_t& other);
static LLSD defaults(const LLSettingsBase::TrackPosition& position = 0.0f);
+ void loadValuesFromLLSD() override;
+ void saveValuesToLLSD() override;
+
//---------------------------------------------------------------------
F32 getBlurMultiplier() const
{
- return (F32)mSettings[SETTING_BLUR_MULTIPLIER].asReal();
+ return mBlurMultiplier;
}
void setBlurMultiplier(F32 val)
{
- setValue(SETTING_BLUR_MULTIPLIER, val);
+ mBlurMultiplier = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
LLColor3 getWaterFogColor() const
{
- return LLColor3(mSettings[SETTING_FOG_COLOR]);
+ return mWaterFogColor;
}
void setWaterFogColor(LLColor3 val)
{
- setValue(SETTING_FOG_COLOR, val);
+ mWaterFogColor = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
F32 getWaterFogDensity() const
{
- return (F32)mSettings[SETTING_FOG_DENSITY].asReal();
+ return mWaterFogDensity;
}
F32 getModifiedWaterFogDensity(bool underwater) const;
void setWaterFogDensity(F32 val)
{
- setValue(SETTING_FOG_DENSITY, val);
+ mWaterFogDensity = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
F32 getFogMod() const
{
- return (F32)mSettings[SETTING_FOG_MOD].asReal();
+ return mFogMod;
}
void setFogMod(F32 val)
{
- setValue(SETTING_FOG_MOD, val);
+ mFogMod = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
F32 getFresnelOffset() const
{
- return (F32)mSettings[SETTING_FRESNEL_OFFSET].asReal();
+ return mFresnelOffset;
}
void setFresnelOffset(F32 val)
{
- setValue(SETTING_FRESNEL_OFFSET, val);
+ mFresnelOffset = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
F32 getFresnelScale() const
{
- return (F32)mSettings[SETTING_FRESNEL_SCALE].asReal();
+ return mFresnelScale;
}
void setFresnelScale(F32 val)
{
- setValue(SETTING_FRESNEL_SCALE, val);
+ mFresnelScale = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
LLUUID getTransparentTextureID() const
{
- return mSettings[SETTING_TRANSPARENT_TEXTURE].asUUID();
+ return mTransparentTextureID;
}
void setTransparentTextureID(LLUUID val)
{
- setValue(SETTING_TRANSPARENT_TEXTURE, val);
+ mTransparentTextureID = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
LLUUID getNormalMapID() const
{
- return mSettings[SETTING_NORMAL_MAP].asUUID();
+ return mNormalMapID;
}
void setNormalMapID(LLUUID val)
{
- setValue(SETTING_NORMAL_MAP, val);
+ mNormalMapID = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
LLVector3 getNormalScale() const
{
- return LLVector3(mSettings[SETTING_NORMAL_SCALE]);
+ return mNormalScale;
}
void setNormalScale(LLVector3 val)
{
- setValue(SETTING_NORMAL_SCALE, val);
+ mNormalScale = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
F32 getScaleAbove() const
{
- return (F32)mSettings[SETTING_SCALE_ABOVE].asReal();
+ return mScaleAbove;
}
void setScaleAbove(F32 val)
{
- setValue(SETTING_SCALE_ABOVE, val);
+ mScaleAbove = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
F32 getScaleBelow() const
{
- return (F32)mSettings[SETTING_SCALE_BELOW].asReal();
+ return mScaleBelow;
}
void setScaleBelow(F32 val)
{
- setValue(SETTING_SCALE_BELOW, val);
+ mScaleBelow = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
LLVector2 getWave1Dir() const
{
- return LLVector2(mSettings[SETTING_WAVE1_DIR]);
+ return mWave1Dir;
}
void setWave1Dir(LLVector2 val)
{
- setValue(SETTING_WAVE1_DIR, val);
+ mWave1Dir = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
LLVector2 getWave2Dir() const
{
- return LLVector2(mSettings[SETTING_WAVE2_DIR]);
+ return mWave2Dir;
}
void setWave2Dir(LLVector2 val)
{
- setValue(SETTING_WAVE2_DIR, val);
+ mWave2Dir = val;
+ setDirtyFlag(true);
+ setLLSDDirty();
}
//-------------------------------------------
@@ -218,7 +248,7 @@ public:
static LLSD translateLegacySettings(LLSD legacy);
- virtual LLSettingsBase::ptr_t buildDerivedClone() const SETTINGS_OVERRIDE { return buildClone(); }
+ virtual LLSettingsBase::ptr_t buildDerivedClone() SETTINGS_OVERRIDE { return buildClone(); }
static LLUUID GetDefaultAssetId();
static LLUUID GetDefaultWaterNormalAssetId();
@@ -241,9 +271,22 @@ protected:
LLSettingsWater();
+ LLUUID mTransparentTextureID;
+ LLUUID mNormalMapID;
LLUUID mNextTransparentTextureID;
LLUUID mNextNormalMapID;
+ F32 mBlurMultiplier;
+ LLColor3 mWaterFogColor;
+ F32 mWaterFogDensity;
+ F32 mFogMod;
+ F32 mFresnelOffset;
+ F32 mFresnelScale;
+ LLVector3 mNormalScale;
+ F32 mScaleAbove;
+ F32 mScaleBelow;
+ LLVector2 mWave1Dir;
+ LLVector2 mWave2Dir;
};
#endif
diff --git a/indra/llmath/llcalcparser.h b/indra/llmath/llcalcparser.h
index ea71752ebc..ec7f6a2cb6 100644
--- a/indra/llmath/llcalcparser.h
+++ b/indra/llmath/llcalcparser.h
@@ -131,14 +131,14 @@ struct LLCalcParser : grammar<LLCalcParser>
power =
unary_expr[power.value = arg1] >>
- *('^' >> assert_syntax(unary_expr[power.value = phoenix::bind(&powf)(power.value, arg1)]))
+ *('^' >> assert_syntax(unary_expr[power.value = phoenix::bind(&LLCalcParser::_pow)(self, power.value, arg1)]))
;
term =
power[term.value = arg1] >>
*(('*' >> assert_syntax(power[term.value *= arg1])) |
('/' >> assert_syntax(power[term.value /= arg1])) |
- ('%' >> assert_syntax(power[term.value = phoenix::bind(&fmodf)(term.value, arg1)]))
+ ('%' >> assert_syntax(power[term.value = phoenix::bind(&LLCalcParser::_fmod)(self, term.value, arg1)]))
)
;
@@ -177,6 +177,8 @@ private:
F32 _floor(const F32& a) const { return (F32)llfloor(a); }
F32 _ceil(const F32& a) const { return (F32)llceil(a); }
F32 _atan2(const F32& a,const F32& b) const { return atan2(a,b); }
+ F32 _pow(const F32& a, const F32& b) const { return powf(a, b); }
+ F32 _fmod(const F32&a, const F32& b) const { return fmodf(a, b); }
LLCalc::calc_map_t* mConstants;
LLCalc::calc_map_t* mVariables;
diff --git a/indra/llmath/llrigginginfo.h b/indra/llmath/llrigginginfo.h
index fb550d013f..d761af68b1 100644
--- a/indra/llmath/llrigginginfo.h
+++ b/indra/llmath/llrigginginfo.h
@@ -66,6 +66,10 @@ public:
const LLJointRiggingInfo& operator[](S32 i) const { return mRigInfoPtr[i]; };
bool needsUpdate() { return mNeedsUpdate; }
void setNeedsUpdate(bool val) { mNeedsUpdate = val; }
+
+ LLJointRiggingInfo* begin() { return mRigInfoPtr; }
+ LLJointRiggingInfo* end() { return mRigInfoPtr + mSize; }
+
private:
// Not implemented
LLJointRiggingInfoTab& operator=(const LLJointRiggingInfoTab& src);
diff --git a/indra/llmath/llsdutil_math.cpp b/indra/llmath/llsdutil_math.cpp
index 0ea1a9c77a..2d5ec7d510 100644
--- a/indra/llmath/llsdutil_math.cpp
+++ b/indra/llmath/llsdutil_math.cpp
@@ -38,8 +38,7 @@
#include "v4color.h"
#if LL_WINDOWS
-# define WIN32_LEAN_AND_MEAN
-# include <winsock2.h> // for htonl
+# include "llwin32headers.h" // for htonl
#elif LL_LINUX
# include <netinet/in.h>
#elif LL_DARWIN
diff --git a/indra/llmessage/llhost.cpp b/indra/llmessage/llhost.cpp
index ace316512f..e7e3e27f58 100644
--- a/indra/llmessage/llhost.cpp
+++ b/indra/llmessage/llhost.cpp
@@ -31,8 +31,7 @@
#include "llerror.h"
#if LL_WINDOWS
- #define WIN32_LEAN_AND_MEAN
- #include <winsock2.h>
+ #include <llwin32headers.h>
#else
#include <netdb.h>
#include <netinet/in.h> // ntonl()
diff --git a/indra/llmessage/lliopipe.h b/indra/llmessage/lliopipe.h
index 1887b5cd9a..b40539f38c 100644
--- a/indra/llmessage/lliopipe.h
+++ b/indra/llmessage/lliopipe.h
@@ -30,7 +30,7 @@
#define LL_LLIOPIPE_H
#include <boost/intrusive_ptr.hpp>
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include "apr_poll.h"
#include "llsd.h"
diff --git a/indra/llmessage/lliosocket.h b/indra/llmessage/lliosocket.h
index 0a3f2617e6..4b79c77b56 100644
--- a/indra/llmessage/lliosocket.h
+++ b/indra/llmessage/lliosocket.h
@@ -38,7 +38,7 @@
*/
#include "lliopipe.h"
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include "apr_pools.h"
#include "apr_network_io.h"
#include "llchainio.h"
diff --git a/indra/llmessage/llmail.cpp b/indra/llmessage/llmail.cpp
index 9e10a356db..b842aeda62 100644
--- a/indra/llmessage/llmail.cpp
+++ b/indra/llmessage/llmail.cpp
@@ -28,7 +28,6 @@
#include "llmail.h"
-// APR on Windows needs full windows headers
#include "llwin32headers.h"
#include <string>
#include <sstream>
diff --git a/indra/llmessage/llnamevalue.cpp b/indra/llmessage/llnamevalue.cpp
index 853ae7df82..05ea3f26a1 100644
--- a/indra/llmessage/llnamevalue.cpp
+++ b/indra/llmessage/llnamevalue.cpp
@@ -967,4 +967,3 @@ std::ostream& operator<<(std::ostream& s, const LLNameValue &a)
}
return s;
}
-
diff --git a/indra/llmessage/llproxy.cpp b/indra/llmessage/llproxy.cpp
index 864e68998c..d713cb20d9 100644
--- a/indra/llmessage/llproxy.cpp
+++ b/indra/llmessage/llproxy.cpp
@@ -465,7 +465,7 @@ void LLProxy::applyProxySettings(CURL* handle)
/**
* @brief Send one TCP packet and receive one in return.
*
- * This operation is done synchronously with a 1000ms timeout. Therefore, it should not be used when a blocking
+ * This operation is done synchronously with a 100ms timeout. Therefore, it should not be used when a blocking
* operation would impact the operation of the viewer.
*
* @param handle_ptr Pointer to a connected LLSocket of type STREAM_TCP.
@@ -482,7 +482,7 @@ static apr_status_t tcp_blocking_handshake(LLSocket::ptr_t handle, char * dataou
apr_size_t expected_len = outlen;
- handle->setBlocking(1000);
+ handle->setBlocking(100000); // 100ms, 100000us. Should be sufficient for localhost, nearby network
rv = apr_socket_send(apr_socket, dataout, &outlen);
if (APR_SUCCESS != rv)
@@ -498,8 +498,6 @@ static apr_status_t tcp_blocking_handshake(LLSocket::ptr_t handle, char * dataou
rv = -1;
}
- ms_sleep(1);
-
if (APR_SUCCESS == rv)
{
expected_len = maxinlen;
diff --git a/indra/llmessage/net.cpp b/indra/llmessage/net.cpp
index 1c49f9be36..f153c938cf 100644
--- a/indra/llmessage/net.cpp
+++ b/indra/llmessage/net.cpp
@@ -32,7 +32,7 @@
#include <stdexcept>
#if LL_WINDOWS
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#else
#include <sys/types.h>
#include <sys/socket.h>
diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt
index 14a69afe6e..005426acde 100644
--- a/indra/llplugin/CMakeLists.txt
+++ b/indra/llplugin/CMakeLists.txt
@@ -31,14 +31,6 @@ set(llplugin_HEADER_FILES
llpluginsharedmemory.h
)
-if(NOT ADDRESS_SIZE EQUAL 32)
- if(WINDOWS)
- ##add_definitions(/FIXED:NO)
- else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
- add_definitions(-fPIC)
- endif(WINDOWS)
-endif(NOT ADDRESS_SIZE EQUAL 32)
-
list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES})
add_library (llplugin ${llplugin_SOURCE_FILES})
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index 8a356da93a..0527c76a2a 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -981,6 +981,15 @@ void LLPluginClassMedia::enableMediaPluginDebugging( bool enable )
sendMessage( message );
}
+#if LL_LINUX
+void LLPluginClassMedia::enablePipeWireVolumeCatcher( bool enable )
+{
+ LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "enable_pipewire_volume_catcher");
+ message.setValueBoolean( "enable", enable );
+ sendMessage( message );
+}
+#endif
+
void LLPluginClassMedia::setTarget(const std::string &target)
{
mTarget = target;
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index d74b790d8f..5d2f3bbb79 100644
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -135,6 +135,10 @@ public:
// Text may be unicode (utf8 encoded)
bool textInput(const std::string &text, MASK modifiers, LLSD native_key_data);
+#if LL_LINUX
+ void enablePipeWireVolumeCatcher( bool enable );
+#endif
+
static std::string sOIDcookieUrl;
static std::string sOIDcookieName;
static std::string sOIDcookieValue;
diff --git a/indra/llplugin/llpluginprocessparent.cpp b/indra/llplugin/llpluginprocessparent.cpp
index 00cc6902d5..b838e05560 100644
--- a/indra/llplugin/llpluginprocessparent.cpp
+++ b/indra/llplugin/llpluginprocessparent.cpp
@@ -48,7 +48,7 @@ LLPluginProcessParentOwner::~LLPluginProcessParentOwner()
bool LLPluginProcessParent::sUseReadThread = false;
apr_pollset_t *LLPluginProcessParent::sPollSet = NULL;
bool LLPluginProcessParent::sPollsetNeedsRebuild = false;
-llcoro::Mutex *LLPluginProcessParent::sInstancesMutex;
+llcoro::Mutex *LLPluginProcessParent::sInstancesMutex = nullptr;
LLPluginProcessParent::mapInstances_t LLPluginProcessParent::sInstances;
LLThread *LLPluginProcessParent::sReadThread = NULL;
@@ -155,6 +155,12 @@ LLPluginProcessParent::ptr_t LLPluginProcessParent::create(LLPluginProcessParent
/*static*/
void LLPluginProcessParent::shutdown()
{
+ if (!sInstancesMutex)
+ {
+ // setup was not complete, skip shutdown
+ return;
+ }
+
llcoro::LockType lock(*sInstancesMutex);
mapInstances_t::iterator it;
diff --git a/indra/llprimitive/lldaeloader.cpp b/indra/llprimitive/lldaeloader.cpp
index f286bff353..7fa4230237 100644
--- a/indra/llprimitive/lldaeloader.cpp
+++ b/indra/llprimitive/lldaeloader.cpp
@@ -1115,19 +1115,17 @@ bool LLDAELoader::OpenFile(const std::string& filename)
if (skin)
{
- domGeometry* geom = daeSafeCast<domGeometry>(skin->getSource().getElement());
-
- if (geom)
+ if (domGeometry* geom = daeSafeCast<domGeometry>(skin->getSource().getElement()))
{
- domMesh* mesh = geom->getMesh();
- if (mesh)
+ if (domMesh* mesh = geom->getMesh())
{
- std::vector< LLPointer< LLModel > >::iterator i = mModelsMap[mesh].begin();
- while (i != mModelsMap[mesh].end())
+ dae_model_map::const_iterator it = mModelsMap.find(mesh);
+ if (it != mModelsMap.end())
{
- LLPointer<LLModel> mdl = *i;
- LLDAELoader::processDomModel(mdl, &dae, root, mesh, skin);
- i++;
+ for (const LLPointer<LLModel>& model : it->second)
+ {
+ LLDAELoader::processDomModel(model, &dae, root, mesh, skin);
+ }
}
}
}
@@ -1297,6 +1295,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
}
}
else
+ {
//Has one or more skeletons
for (std::vector<domInstance_controller::domSkeleton*>::iterator skel_it = skeletons.begin();
skel_it != skeletons.end(); ++skel_it)
@@ -1381,6 +1380,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
}
}//got skeleton?
}
+ }
domSkin::domJoints* joints = skin->getJoints();
@@ -1681,7 +1681,7 @@ void LLDAELoader::processDomModel(LLModel* model, DAE* dae, daeElement* root, do
materials[model->mMaterialList[i]] = LLImportMaterial();
}
mScene[transformation].push_back(LLModelInstance(model, model->mLabel, transformation, materials));
- stretch_extents(model, transformation, mExtents[0], mExtents[1], mFirstTransform);
+ stretch_extents(model, transformation);
}
}
@@ -2074,21 +2074,14 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da
mTransform.condition();
}
- domInstance_geometry* instance_geo = daeSafeCast<domInstance_geometry>(element);
- if (instance_geo)
+ if (domInstance_geometry* instance_geo = daeSafeCast<domInstance_geometry>(element))
{
- domGeometry* geo = daeSafeCast<domGeometry>(instance_geo->getUrl().getElement());
- if (geo)
+ if (domGeometry* geo = daeSafeCast<domGeometry>(instance_geo->getUrl().getElement()))
{
- domMesh* mesh = daeSafeCast<domMesh>(geo->getDescendant(daeElement::matchType(domMesh::ID())));
- if (mesh)
+ if (domMesh* mesh = daeSafeCast<domMesh>(geo->getDescendant(daeElement::matchType(domMesh::ID()))))
{
-
- std::vector< LLPointer< LLModel > >::iterator i = mModelsMap[mesh].begin();
- while (i != mModelsMap[mesh].end())
+ for (LLModel* model : mModelsMap.find(mesh)->second)
{
- LLModel* model = *i;
-
LLMatrix4 transformation = mTransform;
if (mTransform.determinant() < 0)
@@ -2159,8 +2152,7 @@ void LLDAELoader::processElement( daeElement* element, bool& badElement, DAE* da
}
mScene[transformation].push_back(LLModelInstance(model, label, transformation, materials));
- stretch_extents(model, transformation, mExtents[0], mExtents[1], mFirstTransform);
- i++;
+ stretch_extents(model, transformation);
}
}
}
diff --git a/indra/llprimitive/llmodel.cpp b/indra/llprimitive/llmodel.cpp
index 15087a7255..4e3e49ec9f 100644
--- a/indra/llprimitive/llmodel.cpp
+++ b/indra/llprimitive/llmodel.cpp
@@ -91,19 +91,15 @@ std::string LLModel::getStatusString(U32 status)
}
-void LLModel::offsetMesh( const LLVector3& pivotPoint )
+void LLModel::offsetMesh(const LLVector3& pivotPoint)
{
- LLVector4a pivot( pivotPoint[VX], pivotPoint[VY], pivotPoint[VZ] );
+ LLVector4a pivot(pivotPoint[VX], pivotPoint[VY], pivotPoint[VZ]);
- for (std::vector<LLVolumeFace>::iterator faceIt = mVolumeFaces.begin(); faceIt != mVolumeFaces.end(); )
+ for (LLVolumeFace& face : mVolumeFaces)
{
- std::vector<LLVolumeFace>:: iterator currentFaceIt = faceIt++;
- LLVolumeFace& face = *currentFaceIt;
- LLVector4a *pos = (LLVector4a*) face.mPositions;
-
- for (S32 i=0; i<face.mNumVertices; ++i )
+ for (S32 i = 0; i < face.mNumVertices; ++i)
{
- pos[i].add( pivot );
+ face.mPositions[i].add(pivot);
}
}
}
@@ -338,7 +334,7 @@ void LLModel::normalizeVolumeFaces()
}
}
-void LLModel::getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out)
+void LLModel::getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out) const
{
scale_out = mNormalizedScale;
translation_out = mNormalizedTranslation;
@@ -1547,6 +1543,13 @@ void LLMeshSkinInfo::fromLLSD(LLSD& skin)
mLockScaleIfJointPosition = false;
}
+ // combine mBindShapeMatrix and mInvBindMatrix into mBindPoseMatrix
+ mBindPoseMatrix.resize(mInvBindMatrix.size());
+ for (U32 i = 0; i < mInvBindMatrix.size(); ++i)
+ {
+ matMul(mBindShapeMatrix, mInvBindMatrix[i], mBindPoseMatrix[i]);
+ }
+
updateHash();
}
diff --git a/indra/llprimitive/llmodel.h b/indra/llprimitive/llmodel.h
index b0cba2d655..c89037a2d2 100644
--- a/indra/llprimitive/llmodel.h
+++ b/indra/llprimitive/llmodel.h
@@ -56,12 +56,15 @@ public:
LLUUID mMeshID;
std::vector<std::string> mJointNames;
mutable std::vector<S32> mJointNums;
- typedef std::vector<LLMatrix4a, boost::alignment::aligned_allocator<LLMatrix4a, 16>> matrix_list_t;
+ typedef std::vector<LLMatrix4a> matrix_list_t;
matrix_list_t mInvBindMatrix;
// bones/joints position overrides
matrix_list_t mAlternateBindMatrix;
+ // cached multiply of mBindShapeMatrix and mInvBindMatrix
+ matrix_list_t mBindPoseMatrix;
+
LL_ALIGN_16(LLMatrix4a mBindShapeMatrix);
float mPelvisOffset;
@@ -202,8 +205,8 @@ public:
void trimVolumeFacesToSize(U32 new_count = LL_SCULPT_MESH_MAX_FACES, LLVolume::face_list_t* remainder = NULL);
void remapVolumeFaces();
void optimizeVolumeFaces();
- void offsetMesh( const LLVector3& pivotPoint );
- void getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out);
+ void offsetMesh(const LLVector3& pivotPoint);
+ void getNormalizedScaleTranslation(LLVector3& scale_out, LLVector3& translation_out) const;
LLVector3 getTransformedCenter(const LLMatrix4& mat);
//reorder face list based on mMaterialList in this and reference so
diff --git a/indra/llprimitive/llmodelloader.cpp b/indra/llprimitive/llmodelloader.cpp
index ae69c4f8ab..84adec4da5 100644
--- a/indra/llprimitive/llmodelloader.cpp
+++ b/indra/llprimitive/llmodelloader.cpp
@@ -36,7 +36,7 @@
std::list<LLModelLoader*> LLModelLoader::sActiveLoaderList;
-void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4a& max, bool& first_transform)
+static void stretch_extents(const LLModel* model, const LLMatrix4a& mat, LLVector4a& min, LLVector4a& max, bool& first_transform)
{
LLVector4a box[] =
{
@@ -58,7 +58,7 @@ void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4
center.setAdd(face.mExtents[0], face.mExtents[1]);
center.mul(0.5f);
LLVector4a size;
- size.setSub(face.mExtents[1],face.mExtents[0]);
+ size.setSub(face.mExtents[1], face.mExtents[0]);
size.mul(0.5f);
for (U32 i = 0; i < 8; i++)
@@ -84,19 +84,19 @@ void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4
}
}
-void stretch_extents(LLModel* model, LLMatrix4& mat, LLVector3& min, LLVector3& max, bool& first_transform)
+void LLModelLoader::stretch_extents(const LLModel* model, const LLMatrix4& mat)
{
LLVector4a mina, maxa;
LLMatrix4a mata;
mata.loadu(mat);
- mina.load3(min.mV);
- maxa.load3(max.mV);
+ mina.load3(mExtents[0].mV);
+ maxa.load3(mExtents[1].mV);
- stretch_extents(model, mata, mina, maxa, first_transform);
+ ::stretch_extents(model, mata, mina, maxa, mFirstTransform);
- min.set(mina.getF32ptr());
- max.set(maxa.getF32ptr());
+ mExtents[0].set(mina.getF32ptr());
+ mExtents[1].set(maxa.getF32ptr());
}
//-----------------------------------------------------------------------------
@@ -291,14 +291,7 @@ bool LLModelLoader::loadFromSLM(const std::string& filename)
{
if (idx >= model[lod].size())
{
- if (model[lod].size())
- {
- instance_list[i].mLOD[lod] = model[lod][0];
- }
- else
- {
- instance_list[i].mLOD[lod] = NULL;
- }
+ instance_list[i].mLOD[lod] = model[lod].front();
continue;
}
@@ -341,7 +334,7 @@ bool LLModelLoader::loadFromSLM(const std::string& filename)
{
LLModelInstance& cur_instance = instance_list[i];
mScene[cur_instance.mTransform].push_back(cur_instance);
- stretch_extents(cur_instance.mModel, cur_instance.mTransform, mExtents[0], mExtents[1], mFirstTransform);
+ stretch_extents(cur_instance.mModel, cur_instance.mTransform);
}
setLoadState( DONE );
diff --git a/indra/llprimitive/llmodelloader.h b/indra/llprimitive/llmodelloader.h
index 83bd2f5bbd..637dabe08a 100644
--- a/indra/llprimitive/llmodelloader.h
+++ b/indra/llprimitive/llmodelloader.h
@@ -34,13 +34,13 @@
class LLJoint;
-typedef std::map<std::string, LLMatrix4> JointTransformMap;
-typedef std::map<std::string, LLMatrix4>::iterator JointTransformMapIt;
-typedef std::map<std::string, std::string> JointMap;
-typedef std::deque<std::string> JointNameSet;
+typedef std::map<std::string, LLMatrix4> JointTransformMap;
+typedef std::map<std::string, LLMatrix4>::iterator JointTransformMapIt;
+typedef std::map<std::string, std::string> JointMap;
+typedef std::deque<std::string> JointNameSet;
const S32 SLM_SUPPORTED_VERSION = 3;
-const S32 NUM_LOD = 4;
+const S32 NUM_LOD = 4;
const U32 LEGACY_RIG_OK = 0;
const U32 LEGACY_RIG_FLAG_TOO_MANY_JOINTS = 1;
@@ -50,32 +50,32 @@ class LLModelLoader : public LLThread
{
public:
- typedef std::map<std::string, LLImportMaterial> material_map;
- typedef std::vector<LLPointer<LLModel > > model_list;
- typedef std::vector<LLModelInstance> model_instance_list;
- typedef std::map<LLMatrix4, model_instance_list > scene;
+ typedef std::map<std::string, LLImportMaterial> material_map;
+ typedef std::vector<LLPointer<LLModel>> model_list;
+ typedef std::vector<LLModelInstance> model_instance_list;
+ typedef std::map<LLMatrix4, model_instance_list> scene;
// Callback with loaded model data and loaded LoD
//
- typedef boost::function<void (scene&,model_list&,S32,void*) > load_callback_t;
+ typedef boost::function<void (scene&, model_list&, S32, void*)> load_callback_t;
// Function to provide joint lookup by name
// (within preview avi skeleton, for example)
//
- typedef boost::function<LLJoint* (const std::string&,void*) > joint_lookup_func_t;
+ typedef boost::function<LLJoint* (const std::string&, void*)> joint_lookup_func_t;
// Func to load and associate material with all it's textures,
// returned value is the number of textures loaded
// intentionally non-const so func can modify material to
// store platform-specific data
//
- typedef boost::function<U32 (LLImportMaterial&,void*) > texture_load_func_t;
+ typedef boost::function<U32 (LLImportMaterial&, void*)> texture_load_func_t;
// Callback to inform client of state changes
// during loading process (errors will be reported
// as state changes here as well)
//
- typedef boost::function<void (U32,void*) > state_callback_t;
+ typedef boost::function<void (U32, void*)> state_callback_t;
typedef enum
{
@@ -136,7 +136,7 @@ public:
JointNameSet& jointsFromNodes,
JointMap& legalJointNamesMap,
U32 maxJointsPerMesh);
- virtual ~LLModelLoader() ;
+ virtual ~LLModelLoader();
virtual void setNoNormalize() { mNoNormalize = true; }
virtual void setNoOptimize() { mNoOptimize = true; }
@@ -156,13 +156,13 @@ public:
bool loadFromSLM(const std::string& filename);
void loadModelCallback();
- void loadTextures() ; //called in the main thread.
+ void loadTextures(); // called in the main thread.
void setLoadState(U32 state);
+ void stretch_extents(const LLModel* model, const LLMatrix4& mat);
-
- S32 mNumOfFetchingTextures ; //updated in the main thread
- bool areTexturesReady() { return !mNumOfFetchingTextures; } //called in the main thread.
+ S32 mNumOfFetchingTextures; // updated in the main thread
+ bool areTexturesReady() { return !mNumOfFetchingTextures; } // called in the main thread.
bool verifyCount( int expected, int result );
@@ -212,10 +212,7 @@ protected:
LLSD mWarningsArray; // preview floater will pull logs from here
static std::list<LLModelLoader*> sActiveLoaderList;
- static bool isAlive(LLModelLoader* loader) ;
+ static bool isAlive(LLModelLoader* loader);
};
-class LLMatrix4a;
-void stretch_extents(LLModel* model, LLMatrix4a& mat, LLVector4a& min, LLVector4a& max, bool& first_transform);
-void stretch_extents(LLModel* model, LLMatrix4& mat, LLVector3& min, LLVector3& max, bool& first_transform);
#endif // LL_LLMODELLOADER_H
diff --git a/indra/llprimitive/llprimtexturelist.cpp b/indra/llprimitive/llprimtexturelist.cpp
index 68f3f5ffac..76322a9d29 100644
--- a/indra/llprimitive/llprimtexturelist.cpp
+++ b/indra/llprimitive/llprimtexturelist.cpp
@@ -137,14 +137,7 @@ S32 LLPrimTextureList::copyTexture(const U8 index, const LLTextureEntry& te)
// we're changing an existing entry
llassert(mEntryList[index]);
delete (mEntryList[index]);
- if (&te)
- {
- mEntryList[index] = te.newCopy();
- }
- else
- {
- mEntryList[index] = LLPrimTextureList::newTextureEntry();
- }
+ mEntryList[index] = te.newCopy();
return TEM_CHANGE_TEXTURE;
}
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index 6128e03fa7..fa76669258 100644
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -52,7 +52,9 @@
#include "llfontbitmapcache.h"
#include "llgl.h"
-#define ENABLE_OT_SVG_SUPPORT
+#if !defined(LL_NO_OTSVG)
+ #define ENABLE_OT_SVG_SUPPORT
+#endif
FT_Render_Mode gFontRenderMode = FT_RENDER_MODE_NORMAL;
@@ -87,7 +89,7 @@ LLFontManager::LLFontManager()
FT_Done_FreeType(gFTLibrary);
}
-#ifdef ENABLE_OT_SVG_SUPPORT
+#if defined(ENABLE_OT_SVG_SUPPORT)
SVG_RendererHooks hooks = {
LLFontFreeTypeSvgRenderer::OnInit,
LLFontFreeTypeSvgRenderer::OnFree,
@@ -483,8 +485,8 @@ LLFontGlyphInfo* LLFontFreetype::addGlyph(llwchar wch, EFontGlyphType glyph_type
continue;
}
glyph_index = FT_Get_Char_Index(pair.first->mFTFace, wch);
- if (glyph_index)
- {
+ if (glyph_index)
+ {
return addGlyphFromFont(pair.first, wch, glyph_index,
glyph_type);
}
diff --git a/indra/llrender/llfontfreetypesvg.cpp b/indra/llrender/llfontfreetypesvg.cpp
index 71f751329e..15251fe1b1 100644
--- a/indra/llrender/llfontfreetypesvg.cpp
+++ b/indra/llrender/llfontfreetypesvg.cpp
@@ -80,6 +80,7 @@ void LLFontFreeTypeSvgRenderer::OnDataFinalizer(void* objectp)
//static
FT_Error LLFontFreeTypeSvgRenderer::OnPresetGlypthSlot(FT_GlyphSlot glyph_slot, FT_Bool cache, FT_Pointer*)
{
+#ifndef LL_NO_OTSVG
FT_SVG_Document document = static_cast<FT_SVG_Document>(glyph_slot->other);
llassert(!glyph_slot->generic.data || !cache || glyph_slot->glyph_index == ((LLSvgRenderData*)glyph_slot->generic.data)->GlyphIndex);
@@ -166,6 +167,9 @@ FT_Error LLFontFreeTypeSvgRenderer::OnPresetGlypthSlot(FT_GlyphSlot glyph_slot,
}
return FT_Err_Ok;
+#else
+ return FT_Err_Unimplemented_Feature;
+#endif
}
// static
diff --git a/indra/llrender/llfontfreetypesvg.h b/indra/llrender/llfontfreetypesvg.h
index 4170cab273..94b83d5fff 100644
--- a/indra/llrender/llfontfreetypesvg.h
+++ b/indra/llrender/llfontfreetypesvg.h
@@ -29,7 +29,11 @@
#include <ft2build.h>
#include FT_TYPES_H
#include FT_MODULE_H
-#include FT_OTSVG_H
+#ifdef FT_OTSVG_H
+ #include FT_OTSVG_H
+#else
+ #define LL_NO_OTSVG
+#endif
// See https://freetype.org/freetype2/docs/reference/ft2-svg_fonts.html
class LLFontFreeTypeSvgRenderer
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index 9721b020c7..94daba0817 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -271,9 +271,9 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
const LLFontGlyphInfo* next_glyph = NULL;
static constexpr S32 GLYPH_BATCH_SIZE = 30;
- static thread_local LLVector3 vertices[GLYPH_BATCH_SIZE * 4];
- static thread_local LLVector2 uvs[GLYPH_BATCH_SIZE * 4];
- static thread_local LLColor4U colors[GLYPH_BATCH_SIZE * 4];
+ static thread_local LLVector4a vertices[GLYPH_BATCH_SIZE * 6];
+ static thread_local LLVector2 uvs[GLYPH_BATCH_SIZE * 6];
+ static thread_local LLColor4U colors[GLYPH_BATCH_SIZE * 6];
LLColor4U text_color(color);
// Preserve the transparency to render fading emojis in fading text (e.g.
@@ -305,9 +305,9 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
// otherwise the queued glyphs will be taken from wrong textures.
if (glyph_count > 0)
{
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
- gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
+ gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 6);
}
gGL.end();
glyph_count = 0;
@@ -338,9 +338,9 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
if (glyph_count >= GLYPH_BATCH_SIZE)
{
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
- gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
+ gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 6);
}
gGL.end();
@@ -376,9 +376,9 @@ S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, cons
cur_render_y = cur_y;
}
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
- gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 4);
+ gGL.vertexBatchPreTransformed(vertices, uvs, colors, glyph_count * 6);
}
gGL.end();
@@ -1227,31 +1227,42 @@ LLFontGL &LLFontGL::operator=(const LLFontGL &source)
return *this;
}
-void LLFontGL::renderQuad(LLVector3* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, F32 slant_amt) const
+void LLFontGL::renderTriangle(LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, F32 slant_amt) const
{
S32 index = 0;
- vertex_out[index] = LLVector3(screen_rect.mRight, screen_rect.mTop, 0.f);
- uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
+ vertex_out[index].set(screen_rect.mRight, screen_rect.mTop, 0.f);
+ uv_out[index].set(uv_rect.mRight, uv_rect.mTop);
colors_out[index] = color;
index++;
- vertex_out[index] = LLVector3(screen_rect.mLeft, screen_rect.mTop, 0.f);
- uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
+ vertex_out[index].set(screen_rect.mLeft, screen_rect.mTop, 0.f);
+ uv_out[index].set(uv_rect.mLeft, uv_rect.mTop);
colors_out[index] = color;
index++;
- vertex_out[index] = LLVector3(screen_rect.mLeft, screen_rect.mBottom, 0.f);
- uv_out[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
+ vertex_out[index].set(screen_rect.mLeft, screen_rect.mBottom, 0.f);
+ uv_out[index].set(uv_rect.mLeft, uv_rect.mBottom);
colors_out[index] = color;
index++;
- vertex_out[index] = LLVector3(screen_rect.mRight, screen_rect.mBottom, 0.f);
- uv_out[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom);
+
+ vertex_out[index].set(screen_rect.mRight, screen_rect.mTop, 0.f);
+ uv_out[index].set(uv_rect.mRight, uv_rect.mTop);
+ colors_out[index] = color;
+ index++;
+
+ vertex_out[index].set(screen_rect.mLeft, screen_rect.mBottom, 0.f);
+ uv_out[index].set(uv_rect.mLeft, uv_rect.mBottom);
+ colors_out[index] = color;
+ index++;
+
+ vertex_out[index].set(screen_rect.mRight, screen_rect.mBottom, 0.f);
+ uv_out[index].set(uv_rect.mRight, uv_rect.mBottom);
colors_out[index] = color;
}
-void LLFontGL::drawGlyph(S32& glyph_count, LLVector3* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_strength) const
+void LLFontGL::drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_strength) const
{
F32 slant_offset;
slant_offset = ((style & ITALIC) ? ( -mFontFreetype->getAscenderHeight() * 0.2f) : 0.f);
@@ -1265,7 +1276,7 @@ void LLFontGL::drawGlyph(S32& glyph_count, LLVector3* vertex_out, LLVector2* uv_
LLRectf screen_rect_offset = screen_rect;
screen_rect_offset.translate((F32)(pass * BOLD_OFFSET), 0.f);
- renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect_offset, uv_rect, color, slant_offset);
+ renderTriangle(&vertex_out[glyph_count * 6], &uv_out[glyph_count * 6], &colors_out[glyph_count * 6], screen_rect_offset, uv_rect, color, slant_offset);
glyph_count++;
}
}
@@ -1296,10 +1307,10 @@ void LLFontGL::drawGlyph(S32& glyph_count, LLVector3* vertex_out, LLVector2* uv_
break;
}
- renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect_offset, uv_rect, shadow_color, slant_offset);
+ renderTriangle(&vertex_out[glyph_count * 6], &uv_out[glyph_count * 6], &colors_out[glyph_count * 6], screen_rect_offset, uv_rect, shadow_color, slant_offset);
glyph_count++;
}
- renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect, uv_rect, color, slant_offset);
+ renderTriangle(&vertex_out[glyph_count * 6], &uv_out[glyph_count * 6], &colors_out[glyph_count * 6], screen_rect, uv_rect, color, slant_offset);
glyph_count++;
}
else if (shadow == DROP_SHADOW)
@@ -1308,14 +1319,14 @@ void LLFontGL::drawGlyph(S32& glyph_count, LLVector3* vertex_out, LLVector2* uv_
shadow_color.mV[VALPHA] = U8(color.mV[VALPHA] * drop_shadow_strength);
LLRectf screen_rect_shadow = screen_rect;
screen_rect_shadow.translate(1.f, -1.f);
- renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect_shadow, uv_rect, shadow_color, slant_offset);
+ renderTriangle(&vertex_out[glyph_count * 6], &uv_out[glyph_count * 6], &colors_out[glyph_count * 6], screen_rect_shadow, uv_rect, shadow_color, slant_offset);
glyph_count++;
- renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect, uv_rect, color, slant_offset);
+ renderTriangle(&vertex_out[glyph_count * 6], &uv_out[glyph_count * 6], &colors_out[glyph_count * 6], screen_rect, uv_rect, color, slant_offset);
glyph_count++;
}
else // normal rendering
{
- renderQuad(&vertex_out[glyph_count * 4], &uv_out[glyph_count * 4], &colors_out[glyph_count * 4], screen_rect, uv_rect, color, slant_offset);
+ renderTriangle(&vertex_out[glyph_count * 6], &uv_out[glyph_count * 6], &colors_out[glyph_count * 6], screen_rect, uv_rect, color, slant_offset);
glyph_count++;
}
}
diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h
index de7529a583..4bb6c55c65 100644
--- a/indra/llrender/llfontgl.h
+++ b/indra/llrender/llfontgl.h
@@ -238,8 +238,8 @@ private:
LLFontDescriptor mFontDescriptor;
LLPointer<LLFontFreetype> mFontFreetype;
- void renderQuad(LLVector3* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, F32 slant_amt) const;
- void drawGlyph(S32& glyph_count, LLVector3* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_fade) const;
+ void renderTriangle(LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, F32 slant_amt) const;
+ void drawGlyph(S32& glyph_count, LLVector4a* vertex_out, LLVector2* uv_out, LLColor4U* colors_out, const LLRectf& screen_rect, const LLRectf& uv_rect, const LLColor4U& color, U8 style, ShadowType shadow, F32 drop_shadow_fade) const;
// Registry holds all instantiated fonts.
static LLFontRegistry* sFontRegistry;
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index c62cacdce6..15fb289de3 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -215,8 +215,6 @@ LLMatrix4 gGLObliqueProjectionInverse;
std::list<LLGLUpdate*> LLGLUpdate::sGLQ;
-#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS
-
#if LL_WINDOWS
// WGL_ARB_create_context
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribsARB = nullptr;
@@ -236,8 +234,6 @@ PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC wglBlitContextFramebufferAMD = n
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = nullptr;
PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT = nullptr;
-#endif
-
// GL_VERSION_1_2
//PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = nullptr;
//PFNGLTEXIMAGE3DPROC glTexImage3D = nullptr;
@@ -1170,6 +1166,11 @@ bool LLGLManager::initGL()
mGLVendorShort = "INTEL";
mIsIntel = true;
}
+ else if (mGLVendor.find("APPLE") != std::string::npos)
+ {
+ mGLVendorShort = "APPLE";
+ mIsApple = true;
+ }
else
{
mGLVendorShort = "MISC";
@@ -1402,6 +1403,9 @@ void LLGLManager::shutdownGL()
void LLGLManager::initExtensions()
{
+#if LL_LINUX
+ glh_init_extensions("");
+#endif
#if LL_DARWIN
GLint num_extensions = 0;
std::string all_extensions{""};
@@ -1432,10 +1436,9 @@ void LLGLManager::initExtensions()
mInited = true;
-#if (LL_WINDOWS || LL_LINUX) && !LL_MESA_HEADLESS
+#if LL_WINDOWS
LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL;
-#if LL_WINDOWS
// WGL_AMD_gpu_association
wglGetGPUIDsAMD = (PFNWGLGETGPUIDSAMDPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetGPUIDsAMD");
wglGetGPUInfoAMD = (PFNWGLGETGPUINFOAMDPROC)GLH_EXT_GET_PROC_ADDRESS("wglGetGPUInfoAMD");
@@ -1453,8 +1456,6 @@ void LLGLManager::initExtensions()
// WGL_ARB_create_context
wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)GLH_EXT_GET_PROC_ADDRESS("wglCreateContextAttribsARB");
-#endif
-
// Load entire OpenGL API through GetProcAddress, leaving sections beyond mGLVersion unloaded
@@ -2582,6 +2583,7 @@ void parse_gl_version( S32* major, S32* minor, S32* release, std::string* vendor
{
return;
}
+ LL_INFOS() << "GL: " << version << LL_ENDL;
version_string->assign(version);
@@ -2957,5 +2959,3 @@ extern "C"
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
#endif
-
-
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index 17f825bd71..f5b1e8d786 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -102,6 +102,7 @@ public:
bool mIsAMD;
bool mIsNVIDIA;
bool mIsIntel;
+ bool mIsApple = false;
// hints to the render pipe
U32 mDownScaleMethod = 0; // see settings.xml RenderDownScaleMethod
diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h
index c5e1ff3e23..921adc0f8c 100644
--- a/indra/llrender/llglheaders.h
+++ b/indra/llrender/llglheaders.h
@@ -41,12 +41,28 @@
# include "GL/glh_extensions.h"
# undef __APPLE__
+#elif LL_LINUX
+#define GL_GLEXT_PROTOTYPES
+#define GLX_GLEXT_PROTOTYPES
+
+#include "GL/gl.h"
+#include "GL/glext.h"
+#include "GL/glu.h"
+
+// The __APPLE__ kludge is to make glh_extensions.h not symbol-clash horribly
+# define __APPLE__
+# include "GL/glh_extensions.h"
+# undef __APPLE__
+
+# include "GL/glx.h"
+# include "GL/glxext.h"
+
#elif LL_WINDOWS
//----------------------------------------------------------------------------
// LL_WINDOWS
// windows gl headers depend on things like APIENTRY, so include windows.
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
//----------------------------------------------------------------------------
#include <GL/gl.h>
@@ -1029,6 +1045,25 @@ extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *);
#include <OpenGL/gl.h>
+#elif LL_LINUX
+
+#define GL_GLEXT_PROTOTYPES
+#define GLX_GLEXT_PROTOTYPES
+
+#include "GL/gl.h"
+#include "GL/glu.h"
+#include "GL/glext.h"
+#include "GL/glx.h"
+
+// The __APPLE__ kludge is to make glh_extensions.h not symbol-clash horribly
+# define __APPLE__
+# include "GL/glh_extensions.h"
+# undef __APPLE__
+
+// #include <X11/Xlib.h>
+// #include <X11/Xutil.h>
+#include "GL/glh_extensions.h"
+
#endif // LL_MESA / LL_WINDOWS / LL_DARWIN
// Even when GL_ARB_depth_clamp is available in the driver, the (correct)
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index 16a8309a9a..e182b870dc 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -803,7 +803,6 @@ void LLLightState::setSpotDirection(const LLVector3& direction)
LLRender::LLRender()
: mDirty(false),
mCount(0),
- mQuadCycle(0),
mMode(LLRender::TRIANGLES),
mCurrTextureUnitIndex(0)
{
@@ -1299,7 +1298,7 @@ void LLRender::pushUIMatrix()
{
if (mUIOffset.empty())
{
- mUIOffset.push_back(LLVector3(0,0,0));
+ mUIOffset.emplace_back(0.f,0.f,0.f);
}
else
{
@@ -1308,7 +1307,7 @@ void LLRender::pushUIMatrix()
if (mUIScale.empty())
{
- mUIScale.push_back(LLVector3(1,1,1));
+ mUIScale.emplace_back(1.f,1.f,1.f);
}
else
{
@@ -1532,13 +1531,7 @@ void LLRender::begin(const GLuint& mode)
{
if (mode != mMode)
{
- if (mode == LLRender::QUADS)
- {
- mQuadCycle = 1;
- }
-
- if (mMode == LLRender::QUADS ||
- mMode == LLRender::LINES ||
+ if (mMode == LLRender::LINES ||
mMode == LLRender::TRIANGLES ||
mMode == LLRender::POINTS)
{
@@ -1561,8 +1554,7 @@ void LLRender::end()
//IMM_ERRS << "GL begin and end called with no vertices specified." << LL_ENDL;
}
- if ((mMode != LLRender::QUADS &&
- mMode != LLRender::LINES &&
+ if ((mMode != LLRender::LINES &&
mMode != LLRender::TRIANGLES &&
mMode != LLRender::POINTS) ||
mCount > 2048)
@@ -1587,28 +1579,19 @@ void LLRender::flush()
//store mCount in a local variable to avoid re-entrance (drawArrays may call flush)
U32 count = mCount;
- if (mMode == LLRender::QUADS && !sGLCoreProfile)
- {
- if (mCount%4 != 0)
- {
- count -= (mCount % 4);
- LL_WARNS() << "Incomplete quad requested." << LL_ENDL;
- }
- }
-
- if (mMode == LLRender::TRIANGLES)
+ if (mMode == LLRender::TRIANGLES)
+ {
+ if (mCount%3 != 0)
{
- if (mCount%3 != 0)
- {
- count -= (mCount % 3);
- LL_WARNS() << "Incomplete triangle requested." << LL_ENDL;
- }
+ count -= (mCount % 3);
+ LL_WARNS() << "Incomplete triangle requested." << LL_ENDL;
}
+ }
- if (mMode == LLRender::LINES)
+ if (mMode == LLRender::LINES)
+ {
+ if (mCount%2 != 0)
{
- if (mCount%2 != 0)
- {
count -= (mCount % 2);
LL_WARNS() << "Incomplete line requested." << LL_ENDL;
}
@@ -1735,7 +1718,7 @@ LLVertexBuffer* LLRender::genBuffer(U32 attribute_mask, S32 count)
vb->setBuffer();
- vb->setPositionData((LLVector4a*)mVerticesp.get());
+ vb->setPositionData(mVerticesp.get());
if (attribute_mask & LLVertexBuffer::MAP_TEXCOORD0)
{
@@ -1758,16 +1741,7 @@ LLVertexBuffer* LLRender::genBuffer(U32 attribute_mask, S32 count)
void LLRender::drawBuffer(LLVertexBuffer* vb, U32 mode, S32 count)
{
vb->setBuffer();
-
- if (mode == LLRender::QUADS && sGLCoreProfile)
- {
- vb->drawArrays(LLRender::TRIANGLES, 0, count);
- mQuadCycle = 1;
- }
- else
- {
- vb->drawArrays(mode, 0, count);
- }
+ vb->drawArrays(mode, 0, count);
}
void LLRender::resetStriders(S32 count)
@@ -1788,7 +1762,6 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
{
case LLRender::POINTS: flush(); break;
case LLRender::TRIANGLES: if (mCount%3==0) flush(); break;
- case LLRender::QUADS: if(mCount%4 == 0) flush(); break;
case LLRender::LINES: if (mCount%2 == 0) flush(); break;
}
}
@@ -1801,31 +1774,12 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
if (mUIOffset.empty())
{
- mVerticesp[mCount] = LLVector3(x,y,z);
+ mVerticesp[mCount].set(x,y,z);
}
else
{
LLVector3 vert = (LLVector3(x,y,z)+mUIOffset.back()).scaledVec(mUIScale.back());
- mVerticesp[mCount] = vert;
- }
-
- if (mMode == LLRender::QUADS && LLRender::sGLCoreProfile)
- {
- mQuadCycle++;
- if (mQuadCycle == 4)
- { //copy two vertices so fourth quad element will add a triangle
- mQuadCycle = 0;
-
- mCount++;
- mVerticesp[mCount] = mVerticesp[mCount-3];
- mColorsp[mCount] = mColorsp[mCount-3];
- mTexcoordsp[mCount] = mTexcoordsp[mCount-3];
-
- mCount++;
- mVerticesp[mCount] = mVerticesp[mCount-2];
- mColorsp[mCount] = mColorsp[mCount-2];
- mTexcoordsp[mCount] = mTexcoordsp[mCount-2];
- }
+ mVerticesp[mCount].set(vert.mV[VX], vert.mV[VY], vert.mV[VZ]);
}
mCount++;
@@ -1834,7 +1788,7 @@ void LLRender::vertex3f(const GLfloat& x, const GLfloat& y, const GLfloat& z)
mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
}
-void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count)
+void LLRender::vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count)
{
if (mCount + vert_count > 4094)
{
@@ -1842,57 +1796,20 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, S32 vert_count)
return;
}
- if (sGLCoreProfile && mMode == LLRender::QUADS)
- { //quads are deprecated, convert to triangle list
- S32 i = 0;
-
- while (i < vert_count)
- {
- //read first three
- mVerticesp[mCount++] = verts[i++];
- mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
- mColorsp[mCount] = mColorsp[mCount-1];
-
- mVerticesp[mCount++] = verts[i++];
- mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
- mColorsp[mCount] = mColorsp[mCount-1];
-
- mVerticesp[mCount++] = verts[i++];
- mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
- mColorsp[mCount] = mColorsp[mCount-1];
-
- //copy two
- mVerticesp[mCount++] = verts[i-3];
- mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
- mColorsp[mCount] = mColorsp[mCount-1];
-
- mVerticesp[mCount++] = verts[i-1];
- mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
- mColorsp[mCount] = mColorsp[mCount-1];
-
- //copy last one
- mVerticesp[mCount++] = verts[i++];
- mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
- mColorsp[mCount] = mColorsp[mCount-1];
- }
- }
- else
+ for (S32 i = 0; i < vert_count; i++)
{
- for (S32 i = 0; i < vert_count; i++)
- {
- mVerticesp[mCount] = verts[i];
+ mVerticesp[mCount] = verts[i];
- mCount++;
- mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
- mColorsp[mCount] = mColorsp[mCount-1];
- }
+ mCount++;
+ mTexcoordsp[mCount] = mTexcoordsp[mCount-1];
+ mColorsp[mCount] = mColorsp[mCount-1];
}
if( mCount > 0 ) // ND: Guard against crashes if mCount is zero, yes it can happen
mVerticesp[mCount] = mVerticesp[mCount-1];
}
-void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count)
+void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 vert_count)
{
if (mCount + vert_count > 4094)
{
@@ -1900,50 +1817,13 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 v
return;
}
- if (sGLCoreProfile && mMode == LLRender::QUADS)
- { //quads are deprecated, convert to triangle list
- S32 i = 0;
-
- while (i < vert_count)
- {
- //read first three
- mVerticesp[mCount] = verts[i];
- mTexcoordsp[mCount++] = uvs[i++];
- mColorsp[mCount] = mColorsp[mCount-1];
-
- mVerticesp[mCount] = verts[i];
- mTexcoordsp[mCount++] = uvs[i++];
- mColorsp[mCount] = mColorsp[mCount-1];
-
- mVerticesp[mCount] = verts[i];
- mTexcoordsp[mCount++] = uvs[i++];
- mColorsp[mCount] = mColorsp[mCount-1];
-
- //copy last two
- mVerticesp[mCount] = verts[i-3];
- mTexcoordsp[mCount++] = uvs[i-3];
- mColorsp[mCount] = mColorsp[mCount-1];
-
- mVerticesp[mCount] = verts[i-1];
- mTexcoordsp[mCount++] = uvs[i-1];
- mColorsp[mCount] = mColorsp[mCount-1];
-
- //copy last one
- mVerticesp[mCount] = verts[i];
- mTexcoordsp[mCount++] = uvs[i++];
- mColorsp[mCount] = mColorsp[mCount-1];
- }
- }
- else
+ for (S32 i = 0; i < vert_count; i++)
{
- for (S32 i = 0; i < vert_count; i++)
- {
- mVerticesp[mCount] = verts[i];
- mTexcoordsp[mCount] = uvs[i];
+ mVerticesp[mCount] = verts[i];
+ mTexcoordsp[mCount] = uvs[i];
- mCount++;
- mColorsp[mCount] = mColorsp[mCount-1];
- }
+ mCount++;
+ mColorsp[mCount] = mColorsp[mCount-1];
}
if (mCount > 0)
@@ -1953,7 +1833,7 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 v
}
}
-void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U* colors, S32 vert_count)
+void LLRender::vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLColor4U* colors, S32 vert_count)
{
if (mCount + vert_count > 4094)
{
@@ -1961,51 +1841,13 @@ void LLRender::vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLCol
return;
}
-
- if (sGLCoreProfile && mMode == LLRender::QUADS)
- { //quads are deprecated, convert to triangle list
- S32 i = 0;
-
- while (i < vert_count)
- {
- //read first three
- mVerticesp[mCount] = verts[i];
- mTexcoordsp[mCount] = uvs[i];
- mColorsp[mCount++] = colors[i++];
-
- mVerticesp[mCount] = verts[i];
- mTexcoordsp[mCount] = uvs[i];
- mColorsp[mCount++] = colors[i++];
-
- mVerticesp[mCount] = verts[i];
- mTexcoordsp[mCount] = uvs[i];
- mColorsp[mCount++] = colors[i++];
-
- //copy last two
- mVerticesp[mCount] = verts[i-3];
- mTexcoordsp[mCount] = uvs[i-3];
- mColorsp[mCount++] = colors[i-3];
-
- mVerticesp[mCount] = verts[i-1];
- mTexcoordsp[mCount] = uvs[i-1];
- mColorsp[mCount++] = colors[i-1];
-
- //copy last one
- mVerticesp[mCount] = verts[i];
- mTexcoordsp[mCount] = uvs[i];
- mColorsp[mCount++] = colors[i++];
- }
- }
- else
+ for (S32 i = 0; i < vert_count; i++)
{
- for (S32 i = 0; i < vert_count; i++)
- {
- mVerticesp[mCount] = verts[i];
- mTexcoordsp[mCount] = uvs[i];
- mColorsp[mCount] = colors[i];
+ mVerticesp[mCount] = verts[i];
+ mTexcoordsp[mCount] = uvs[i];
+ mColorsp[mCount] = colors[i];
- mCount++;
- }
+ mCount++;
}
if (mCount > 0)
@@ -2038,7 +1880,7 @@ void LLRender::vertex3fv(const GLfloat* v)
void LLRender::texCoord2f(const GLfloat& x, const GLfloat& y)
{
- mTexcoordsp[mCount] = LLVector2(x,y);
+ mTexcoordsp[mCount].set(x,y);
}
void LLRender::texCoord2i(const GLint& x, const GLint& y)
@@ -2055,7 +1897,7 @@ void LLRender::color4ub(const GLubyte& r, const GLubyte& g, const GLubyte& b, co
{
if (!LLGLSLShader::sCurBoundShaderPtr || LLGLSLShader::sCurBoundShaderPtr->mAttributeMask & LLVertexBuffer::MAP_COLOR)
{
- mColorsp[mCount] = LLColor4U(r,g,b,a);
+ mColorsp[mCount].set(r,g,b,a);
}
else
{ //not using shaders or shader reads color from a uniform
diff --git a/indra/llrender/llrender.h b/indra/llrender/llrender.h
index 2645597b1a..fc7c5ccc18 100644
--- a/indra/llrender/llrender.h
+++ b/indra/llrender/llrender.h
@@ -319,7 +319,6 @@ public:
POINTS,
LINES,
LINE_STRIP,
- QUADS,
LINE_LOOP,
NUM_MODES
};
@@ -450,9 +449,9 @@ public:
void diffuseColor4ubv(const U8* c);
void diffuseColor4ub(U8 r, U8 g, U8 b, U8 a);
- void vertexBatchPreTransformed(LLVector3* verts, S32 vert_count);
- void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, S32 vert_count);
- void vertexBatchPreTransformed(LLVector3* verts, LLVector2* uvs, LLColor4U*, S32 vert_count);
+ void vertexBatchPreTransformed(LLVector4a* verts, S32 vert_count);
+ void vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, S32 vert_count);
+ void vertexBatchPreTransformed(LLVector4a* verts, LLVector2* uvs, LLColor4U*, S32 vert_count);
void setColorMask(bool writeColor, bool writeAlpha);
void setColorMask(bool writeColorR, bool writeColorG, bool writeColorB, bool writeAlpha);
@@ -508,14 +507,13 @@ private:
LLColor4 mAmbientLightColor;
bool mDirty;
- U32 mQuadCycle;
U32 mCount;
U32 mMode;
U32 mCurrTextureUnitIndex;
bool mCurrColorMask[4];
LLPointer<LLVertexBuffer> mBuffer;
- LLStrider<LLVector3> mVerticesp;
+ LLStrider<LLVector4a> mVerticesp;
LLStrider<LLVector2> mTexcoordsp;
LLStrider<LLColor4U> mColorsp;
std::array<LLTexUnit, LL_NUM_TEXTURE_LAYERS> mTexUnits;
diff --git a/indra/llrender/llrender2dutils.cpp b/indra/llrender/llrender2dutils.cpp
index 428370057e..20ad0275bd 100644
--- a/indra/llrender/llrender2dutils.cpp
+++ b/indra/llrender/llrender2dutils.cpp
@@ -122,10 +122,13 @@ void gl_rect_2d(S32 left, S32 top, S32 right, S32 bottom, bool filled )
// Counterclockwise quad will face the viewer
if( filled )
{
- gGL.begin( LLRender::QUADS );
+ gGL.begin( LLRender::TRIANGLES );
gGL.vertex2i(left, top);
gGL.vertex2i(left, bottom);
gGL.vertex2i(right, bottom);
+
+ gGL.vertex2i(left, top);
+ gGL.vertex2i(right, bottom);
gGL.vertex2i(right, top);
gGL.end();
}
@@ -172,50 +175,70 @@ void gl_drop_shadow(S32 left, S32 top, S32 right, S32 bottom, const LLColor4 &st
LLColor4 end_color = start_color;
end_color.mV[VALPHA] = 0.f;
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
// Right edge, CCW faces screen
gGL.color4fv(start_color.mV);
- gGL.vertex2i(right, top-lines);
- gGL.vertex2i(right, bottom);
+ gGL.vertex2i(right, top - lines);
+ gGL.vertex2i(right, bottom);
+ gGL.color4fv(end_color.mV);
+ gGL.vertex2i(right + lines, bottom);
+ gGL.color4fv(start_color.mV);
+ gGL.vertex2i(right, top - lines);
gGL.color4fv(end_color.mV);
- gGL.vertex2i(right+lines, bottom);
- gGL.vertex2i(right+lines, top-lines);
+ gGL.vertex2i(right + lines, bottom);
+ gGL.vertex2i(right + lines, top - lines);
// Bottom edge, CCW faces screen
gGL.color4fv(start_color.mV);
- gGL.vertex2i(right, bottom);
- gGL.vertex2i(left+lines, bottom);
+ gGL.vertex2i(right, bottom);
+ gGL.vertex2i(left + lines, bottom);
+ gGL.color4fv(end_color.mV);
+ gGL.vertex2i(left + lines, bottom - lines);
+ gGL.color4fv(start_color.mV);
+ gGL.vertex2i(right, bottom);
gGL.color4fv(end_color.mV);
- gGL.vertex2i(left+lines, bottom-lines);
- gGL.vertex2i(right, bottom-lines);
+ gGL.vertex2i(left + lines, bottom - lines);
+ gGL.vertex2i(right, bottom - lines);
// bottom left Corner
gGL.color4fv(start_color.mV);
- gGL.vertex2i(left+lines, bottom);
+ gGL.vertex2i(left + lines, bottom);
gGL.color4fv(end_color.mV);
- gGL.vertex2i(left, bottom);
+ gGL.vertex2i(left, bottom);
// make the bottom left corner not sharp
- gGL.vertex2i(left+1, bottom-lines+1);
- gGL.vertex2i(left+lines, bottom-lines);
+ gGL.vertex2i(left + 1, bottom - lines + 1);
+ gGL.color4fv(start_color.mV);
+ gGL.vertex2i(left + lines, bottom);
+ gGL.color4fv(end_color.mV);
+ gGL.vertex2i(left + 1, bottom - lines + 1);
+ gGL.vertex2i(left + lines, bottom - lines);
// bottom right corner
gGL.color4fv(start_color.mV);
- gGL.vertex2i(right, bottom);
+ gGL.vertex2i(right, bottom);
gGL.color4fv(end_color.mV);
- gGL.vertex2i(right, bottom-lines);
+ gGL.vertex2i(right, bottom - lines);
// make the rightmost corner not sharp
- gGL.vertex2i(right+lines-1, bottom-lines+1);
- gGL.vertex2i(right+lines, bottom);
+ gGL.vertex2i(right + lines - 1, bottom - lines + 1);
+ gGL.color4fv(start_color.mV);
+ gGL.vertex2i(right, bottom);
+ gGL.color4fv(end_color.mV);
+ gGL.vertex2i(right + lines - 1, bottom - lines + 1);
+ gGL.vertex2i(right + lines, bottom);
// top right corner
gGL.color4fv(start_color.mV);
- gGL.vertex2i( right, top-lines );
+ gGL.vertex2i(right, top - lines);
gGL.color4fv(end_color.mV);
- gGL.vertex2i( right+lines, top-lines );
+ gGL.vertex2i(right + lines, top - lines);
// make the corner not sharp
- gGL.vertex2i( right+lines-1, top-1 );
- gGL.vertex2i( right, top );
+ gGL.vertex2i(right + lines - 1, top - 1);
+ gGL.color4fv(start_color.mV);
+ gGL.vertex2i(right, top - lines);
+ gGL.color4fv(end_color.mV);
+ gGL.vertex2i(right + lines - 1, top - 1);
+ gGL.vertex2i(right, top);
gGL.end();
stop_glerror();
@@ -423,171 +446,251 @@ void gl_draw_scaled_image_with_border(S32 x, S32 y, S32 width, S32 height, LLTex
ui_translation.mV[VX] + width * ui_scale.mV[VX],
ui_translation.mV[VY]);
- LLGLSUIDefault gls_ui;
-
gGL.getTexUnit(0)->bind(image, true);
gGL.color4fv(color.mV);
- const S32 NUM_VERTICES = 9 * 4; // 9 quads
- LLVector2 uv[NUM_VERTICES];
- LLVector3 pos[NUM_VERTICES];
+ constexpr S32 NUM_VERTICES = 9 * 2 * 3; // 9 quads, 2 triangles per quad, 3 vertices per triangle
+ static thread_local LLVector2 uv[NUM_VERTICES];
+ static thread_local LLVector4a pos[NUM_VERTICES];
S32 index = 0;
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
- // draw bottom left
- uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mBottom);
- pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f);
+ // draw bottom left triangles
+ // 1
+ uv[index].set(uv_outer_rect.mLeft, uv_outer_rect.mBottom);
+ pos[index].set(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom);
- pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f);
+ uv[index].set(uv_center_rect.mLeft, uv_outer_rect.mBottom);
+ pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom);
- pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
+ uv[index].set(uv_center_rect.mLeft, uv_center_rect.mBottom);
+ pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom);
- pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f);
+ // 2
+ uv[index].set(uv_outer_rect.mLeft, uv_outer_rect.mBottom);
+ pos[index].set(draw_outer_rect.mLeft, draw_outer_rect.mBottom, 0.f);
index++;
- // draw bottom middle
- uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mBottom);
- pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f);
+ uv[index].set(uv_center_rect.mLeft, uv_center_rect.mBottom);
+ pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom);
- pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f);
+ uv[index].set(uv_outer_rect.mLeft, uv_center_rect.mBottom);
+ pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom);
- pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
+ // draw bottom middle triangles
+ uv[index].set(uv_center_rect.mLeft, uv_outer_rect.mBottom);
+ pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom);
- pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
+ uv[index].set(uv_center_rect.mRight, uv_outer_rect.mBottom);
+ pos[index].set(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f);
index++;
- // draw bottom right
- uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mBottom);
- pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f);
+ uv[index].set(uv_center_rect.mRight, uv_center_rect.mBottom);
+ pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mBottom);
- pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f);
+ // 2
+ uv[index].set(uv_center_rect.mLeft, uv_outer_rect.mBottom);
+ pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom);
- pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f);
+ uv[index].set(uv_center_rect.mRight, uv_center_rect.mBottom);
+ pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom);
- pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
+ uv[index].set(uv_center_rect.mLeft, uv_center_rect.mBottom);
+ pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
index++;
- // draw left
- uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mBottom);
- pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f);
+ // draw bottom right triangles
+ uv[index].set(uv_center_rect.mRight, uv_outer_rect.mBottom);
+ pos[index].set(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom);
- pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
+ uv[index].set(uv_outer_rect.mRight, uv_outer_rect.mBottom);
+ pos[index].set(draw_outer_rect.mRight, draw_outer_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop);
- pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
+ uv[index].set(uv_outer_rect.mRight, uv_center_rect.mBottom);
+ pos[index].set(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop);
- pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f);
+ // 2
+ uv[index].set(uv_center_rect.mRight, uv_outer_rect.mBottom);
+ pos[index].set(draw_center_rect.mRight, draw_outer_rect.mBottom, 0.f);
index++;
- // draw middle
- uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mBottom);
- pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
+ uv[index].set(uv_outer_rect.mRight, uv_center_rect.mBottom);
+ pos[index].set(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom);
- pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
+ uv[index].set(uv_center_rect.mRight, uv_center_rect.mBottom);
+ pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop);
- pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
+ // draw left triangles
+ uv[index].set(uv_outer_rect.mLeft, uv_center_rect.mBottom);
+ pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop);
- pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
+ uv[index].set(uv_center_rect.mLeft, uv_center_rect.mBottom);
+ pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
index++;
- // draw right
- uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mBottom);
- pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
+ uv[index].set(uv_center_rect.mLeft, uv_center_rect.mTop);
+ pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
index++;
- uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mBottom);
- pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f);
+ // 2
+ uv[index].set(uv_outer_rect.mLeft, uv_center_rect.mBottom);
+ pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop);
- pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f);
+ uv[index].set(uv_center_rect.mLeft, uv_center_rect.mTop);
+ pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop);
- pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
+ uv[index].set(uv_outer_rect.mLeft, uv_center_rect.mTop);
+ pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f);
index++;
- // draw top left
- uv[index] = LLVector2(uv_outer_rect.mLeft, uv_center_rect.mTop);
- pos[index] = LLVector3(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f);
+ // draw middle triangles
+ uv[index].set(uv_center_rect.mLeft, uv_center_rect.mBottom);
+ pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop);
- pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
+ uv[index].set(uv_center_rect.mRight, uv_center_rect.mBottom);
+ pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop);
- pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f);
+ uv[index].set(uv_center_rect.mRight, uv_center_rect.mTop);
+ pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
index++;
- uv[index] = LLVector2(uv_outer_rect.mLeft, uv_outer_rect.mTop);
- pos[index] = LLVector3(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f);
+ // 2
+ uv[index].set(uv_center_rect.mLeft, uv_center_rect.mBottom);
+ pos[index].set(draw_center_rect.mLeft, draw_center_rect.mBottom, 0.f);
index++;
- // draw top middle
- uv[index] = LLVector2(uv_center_rect.mLeft, uv_center_rect.mTop);
- pos[index] = LLVector3(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
+ uv[index].set(uv_center_rect.mRight, uv_center_rect.mTop);
+ pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop);
- pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
+ uv[index].set(uv_center_rect.mLeft, uv_center_rect.mTop);
+ pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop);
- pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f);
+ // draw right triangles
+ uv[index].set(uv_center_rect.mRight, uv_center_rect.mBottom);
+ pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mLeft, uv_outer_rect.mTop);
- pos[index] = LLVector3(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f);
+ uv[index].set(uv_outer_rect.mRight, uv_center_rect.mBottom);
+ pos[index].set(draw_outer_rect.mRight, draw_center_rect.mBottom, 0.f);
index++;
- // draw top right
- uv[index] = LLVector2(uv_center_rect.mRight, uv_center_rect.mTop);
- pos[index] = LLVector3(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
+ uv[index].set(uv_outer_rect.mRight, uv_center_rect.mTop);
+ pos[index].set(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f);
index++;
- uv[index] = LLVector2(uv_outer_rect.mRight, uv_center_rect.mTop);
- pos[index] = LLVector3(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f);
+ // 2
+ uv[index].set(uv_center_rect.mRight, uv_center_rect.mBottom);
+ pos[index].set(draw_center_rect.mRight, draw_center_rect.mBottom, 0.f);
index++;
- uv[index] = LLVector2(uv_outer_rect.mRight, uv_outer_rect.mTop);
- pos[index] = LLVector3(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f);
+ uv[index].set(uv_outer_rect.mRight, uv_center_rect.mTop);
+ pos[index].set(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f);
index++;
- uv[index] = LLVector2(uv_center_rect.mRight, uv_outer_rect.mTop);
- pos[index] = LLVector3(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f);
+ uv[index].set(uv_center_rect.mRight, uv_center_rect.mTop);
+ pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
+ index++;
+
+ // draw top left triangles
+ uv[index].set(uv_outer_rect.mLeft, uv_center_rect.mTop);
+ pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f);
+ index++;
+
+ uv[index].set(uv_center_rect.mLeft, uv_center_rect.mTop);
+ pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
+ index++;
+
+ uv[index].set(uv_center_rect.mLeft, uv_outer_rect.mTop);
+ pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f);
+ index++;
+
+ // 2
+ uv[index].set(uv_outer_rect.mLeft, uv_center_rect.mTop);
+ pos[index].set(draw_outer_rect.mLeft, draw_center_rect.mTop, 0.f);
+ index++;
+
+ uv[index].set(uv_center_rect.mLeft, uv_outer_rect.mTop);
+ pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f);
+ index++;
+
+ uv[index].set(uv_outer_rect.mLeft, uv_outer_rect.mTop);
+ pos[index].set(draw_outer_rect.mLeft, draw_outer_rect.mTop, 0.f);
+ index++;
+
+ // draw top middle triangles
+ uv[index].set(uv_center_rect.mLeft, uv_center_rect.mTop);
+ pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
+ index++;
+
+ uv[index].set(uv_center_rect.mRight, uv_center_rect.mTop);
+ pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
+ index++;
+
+ uv[index].set(uv_center_rect.mRight, uv_outer_rect.mTop);
+ pos[index].set(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f);
+ index++;
+
+ // 2
+ uv[index].set(uv_center_rect.mLeft, uv_center_rect.mTop);
+ pos[index].set(draw_center_rect.mLeft, draw_center_rect.mTop, 0.f);
+ index++;
+
+ uv[index].set(uv_center_rect.mRight, uv_outer_rect.mTop);
+ pos[index].set(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f);
+ index++;
+
+ uv[index].set(uv_center_rect.mLeft, uv_outer_rect.mTop);
+ pos[index].set(draw_center_rect.mLeft, draw_outer_rect.mTop, 0.f);
+ index++;
+
+ // draw top right triangles
+ uv[index].set(uv_center_rect.mRight, uv_center_rect.mTop);
+ pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
+ index++;
+
+ uv[index].set(uv_outer_rect.mRight, uv_center_rect.mTop);
+ pos[index].set(draw_outer_rect.mRight, draw_center_rect.mTop, 0.f);
+ index++;
+
+ uv[index].set(uv_outer_rect.mRight, uv_outer_rect.mTop);
+ pos[index].set(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f);
+ index++;
+
+ // 2
+ uv[index].set(uv_center_rect.mRight, uv_center_rect.mTop);
+ pos[index].set(draw_center_rect.mRight, draw_center_rect.mTop, 0.f);
+ index++;
+
+ uv[index].set(uv_outer_rect.mRight, uv_outer_rect.mTop);
+ pos[index].set(draw_outer_rect.mRight, draw_outer_rect.mTop, 0.f);
+ index++;
+
+ uv[index].set(uv_center_rect.mRight, uv_outer_rect.mTop);
+ pos[index].set(draw_center_rect.mRight, draw_outer_rect.mTop, 0.f);
index++;
gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES);
@@ -614,8 +717,6 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
return;
}
- LLGLSUIDefault gls_ui;
-
if(image != NULL)
{
gGL.getTexUnit(0)->bind(image, true);
@@ -629,11 +730,11 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
if (degrees == 0.f)
{
- const S32 NUM_VERTICES = 4; // 9 quads
- LLVector2 uv[NUM_VERTICES];
- LLVector3 pos[NUM_VERTICES];
+ constexpr S32 NUM_VERTICES = 2 * 3;
+ static thread_local LLVector2 uv[NUM_VERTICES +1];
+ static thread_local LLVector4a pos[NUM_VERTICES +1];
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
LLVector3 ui_scale = gGL.getUIScale();
LLVector3 ui_translation = gGL.getUITranslation();
@@ -644,20 +745,28 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
S32 scaled_width = ll_round(width * ui_scale.mV[VX]);
S32 scaled_height = ll_round(height * ui_scale.mV[VY]);
- uv[index] = LLVector2(uv_rect.mRight, uv_rect.mTop);
- pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f);
+ uv[index].set(uv_rect.mRight, uv_rect.mTop);
+ pos[index].set(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f);
+ index++;
+
+ uv[index].set(uv_rect.mLeft, uv_rect.mTop);
+ pos[index].set(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f);
+ index++;
+
+ uv[index].set(uv_rect.mLeft, uv_rect.mBottom);
+ pos[index].set(ui_translation.mV[VX], ui_translation.mV[VY], 0.f);
index++;
- uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mTop);
- pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY] + scaled_height, 0.f);
+ uv[index].set(uv_rect.mRight, uv_rect.mTop);
+ pos[index].set(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY] + scaled_height, 0.f);
index++;
- uv[index] = LLVector2(uv_rect.mLeft, uv_rect.mBottom);
- pos[index] = LLVector3(ui_translation.mV[VX], ui_translation.mV[VY], 0.f);
+ uv[index].set(uv_rect.mLeft, uv_rect.mBottom);
+ pos[index].set(ui_translation.mV[VX], ui_translation.mV[VY], 0.f);
index++;
- uv[index] = LLVector2(uv_rect.mRight, uv_rect.mBottom);
- pos[index] = LLVector3(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY], 0.f);
+ uv[index].set(uv_rect.mRight, uv_rect.mBottom);
+ pos[index].set(ui_translation.mV[VX] + scaled_width, ui_translation.mV[VY], 0.f);
index++;
gGL.vertexBatchPreTransformed(pos, uv, NUM_VERTICES);
@@ -687,7 +796,7 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
gGL.color4fv(color.mV);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
LLVector3 v;
@@ -703,6 +812,14 @@ void gl_draw_scaled_rotated_image(S32 x, S32 y, S32 width, S32 height, F32 degre
gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
gGL.vertex2f(v.mV[0], v.mV[1] );
+ v = LLVector3(offset_x, offset_y, 0.f) * quat;
+ gGL.texCoord2f(uv_rect.mRight, uv_rect.mTop);
+ gGL.vertex2f(v.mV[0], v.mV[1]);
+
+ v = LLVector3(-offset_x, -offset_y, 0.f) * quat;
+ gGL.texCoord2f(uv_rect.mLeft, uv_rect.mBottom);
+ gGL.vertex2f(v.mV[0], v.mV[1]);
+
v = LLVector3(offset_x, -offset_y, 0.f) * quat;
gGL.texCoord2f(uv_rect.mRight, uv_rect.mBottom);
gGL.vertex2f(v.mV[0], v.mV[1] );
@@ -948,7 +1065,7 @@ void gl_washer_segment_2d(F32 outer_radius, F32 inner_radius, F32 start_radians,
void gl_rect_2d_simple_tex( S32 width, S32 height )
{
- gGL.begin( LLRender::QUADS );
+ gGL.begin( LLRender::TRIANGLES );
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2i(width, height);
@@ -959,6 +1076,12 @@ void gl_rect_2d_simple_tex( S32 width, S32 height )
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2i(0, 0);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex2i(width, height);
+
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2i(0, 0);
+
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2i(width, 0);
@@ -967,10 +1090,13 @@ void gl_rect_2d_simple_tex( S32 width, S32 height )
void gl_rect_2d_simple( S32 width, S32 height )
{
- gGL.begin( LLRender::QUADS );
+ gGL.begin( LLRender::TRIANGLES );
gGL.vertex2i(width, height);
gGL.vertex2i(0, height);
gGL.vertex2i(0, 0);
+
+ gGL.vertex2i(width, height);
+ gGL.vertex2i(0, 0);
gGL.vertex2i(width, 0);
gGL.end();
}
@@ -1011,7 +1137,7 @@ void gl_segmented_rect_2d_tex(const S32 left,
LLVector2 width_vec((F32)width, 0.f);
LLVector2 height_vec(0.f, (F32)height);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
// draw bottom left
gGL.texCoord2f(0.f, 0.f);
@@ -1023,6 +1149,12 @@ void gl_segmented_rect_2d_tex(const S32 left,
gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
gGL.vertex2fv((border_width_left + border_height_bottom).mV);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2f(0.f, 0.f);
+
+ gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((border_width_left + border_height_bottom).mV);
+
gGL.texCoord2f(0.f, border_uv_scale.mV[VY]);
gGL.vertex2fv(border_height_bottom.mV);
@@ -1036,6 +1168,12 @@ void gl_segmented_rect_2d_tex(const S32 left,
gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 0.f);
+ gGL.vertex2fv(border_width_left.mV);
+
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV);
+
gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
gGL.vertex2fv((border_width_left + border_height_bottom).mV);
@@ -1049,6 +1187,12 @@ void gl_segmented_rect_2d_tex(const S32 left,
gGL.texCoord2f(1.f, border_uv_scale.mV[VY]);
gGL.vertex2fv((width_vec + border_height_bottom).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 0.f);
+ gGL.vertex2fv((width_vec - border_width_right).mV);
+
+ gGL.texCoord2f(1.f, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec + border_height_bottom).mV);
+
gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV);
@@ -1062,6 +1206,12 @@ void gl_segmented_rect_2d_tex(const S32 left,
gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV);
+ gGL.texCoord2f(0.f, border_uv_scale.mV[VY]);
+ gGL.vertex2fv(border_height_bottom.mV);
+
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV);
+
gGL.texCoord2f(0.f, 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((height_vec - border_height_top).mV);
@@ -1075,6 +1225,12 @@ void gl_segmented_rect_2d_tex(const S32 left,
gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((border_width_left + border_height_bottom).mV);
+
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
+
gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV);
@@ -1088,6 +1244,12 @@ void gl_segmented_rect_2d_tex(const S32 left,
gGL.texCoord2f(1.f, 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((width_vec + height_vec - border_height_top).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec - border_width_right + border_height_bottom).mV);
+
+ gGL.texCoord2f(1.f, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec + height_vec - border_height_top).mV);
+
gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
@@ -1101,6 +1263,12 @@ void gl_segmented_rect_2d_tex(const S32 left,
gGL.texCoord2f(border_uv_scale.mV[VX], 1.f);
gGL.vertex2fv((border_width_left + height_vec).mV);
+ gGL.texCoord2f(0.f, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((height_vec - border_height_top).mV);
+
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f);
+ gGL.vertex2fv((border_width_left + height_vec).mV);
+
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2fv((height_vec).mV);
@@ -1114,6 +1282,12 @@ void gl_segmented_rect_2d_tex(const S32 left,
gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
gGL.vertex2fv((width_vec - border_width_right + height_vec).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((border_width_left + height_vec - border_height_top).mV);
+
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
+ gGL.vertex2fv((width_vec - border_width_right + height_vec).mV);
+
gGL.texCoord2f(border_uv_scale.mV[VX], 1.f);
gGL.vertex2fv((border_width_left + height_vec).mV);
@@ -1127,6 +1301,12 @@ void gl_segmented_rect_2d_tex(const S32 left,
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2fv((width_vec + height_vec).mV);
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((width_vec - border_width_right + height_vec - border_height_top).mV);
+
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex2fv((width_vec + height_vec).mV);
+
gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
gGL.vertex2fv((width_vec - border_width_right + height_vec).mV);
}
@@ -1181,7 +1361,7 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,
LLVector2 x_min;
LLVector2 x_max;
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
if (start_fragment < middle_start)
{
@@ -1200,6 +1380,12 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,
gGL.texCoord2f(u_max, border_uv_scale.mV[VY]);
gGL.vertex2fv((x_max + border_height_bottom).mV);
+ gGL.texCoord2f(u_min, 0.f);
+ gGL.vertex2fv(x_min.mV);
+
+ gGL.texCoord2f(u_max, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + border_height_bottom).mV);
+
gGL.texCoord2f(u_min, border_uv_scale.mV[VY]);
gGL.vertex2fv((x_min + border_height_bottom).mV);
@@ -1213,6 +1399,12 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,
gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
+ gGL.texCoord2f(u_min, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + border_height_bottom).mV);
+
+ gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
+
gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
@@ -1226,6 +1418,12 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,
gGL.texCoord2f(u_max, 1.f);
gGL.vertex2fv((x_max + height_vec).mV);
+ gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
+
+ gGL.texCoord2f(u_max, 1.f);
+ gGL.vertex2fv((x_max + height_vec).mV);
+
gGL.texCoord2f(u_min, 1.f);
gGL.vertex2fv((x_min + height_vec).mV);
}
@@ -1245,6 +1443,12 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,
gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
gGL.vertex2fv((x_max + border_height_bottom).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 0.f);
+ gGL.vertex2fv(x_min.mV);
+
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + border_height_bottom).mV);
+
gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
gGL.vertex2fv((x_min + border_height_bottom).mV);
@@ -1258,6 +1462,12 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,
gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + border_height_bottom).mV);
+
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
+
gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
@@ -1271,6 +1481,12 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,
gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
gGL.vertex2fv((x_max + height_vec).mV);
+ gGL.texCoord2f(border_uv_scale.mV[VX], 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
+
+ gGL.texCoord2f(1.f - border_uv_scale.mV[VX], 1.f);
+ gGL.vertex2fv((x_max + height_vec).mV);
+
gGL.texCoord2f(border_uv_scale.mV[VX], 1.f);
gGL.vertex2fv((x_min + height_vec).mV);
}
@@ -1292,6 +1508,12 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,
gGL.texCoord2f(u_max, border_uv_scale.mV[VY]);
gGL.vertex2fv((x_max + border_height_bottom).mV);
+ gGL.texCoord2f(u_min, 0.f);
+ gGL.vertex2fv((x_min).mV);
+
+ gGL.texCoord2f(u_max, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + border_height_bottom).mV);
+
gGL.texCoord2f(u_min, border_uv_scale.mV[VY]);
gGL.vertex2fv((x_min + border_height_bottom).mV);
@@ -1305,6 +1527,12 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,
gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
+ gGL.texCoord2f(u_min, border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + border_height_bottom).mV);
+
+ gGL.texCoord2f(u_max, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_max + height_vec - border_height_top).mV);
+
gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
@@ -1318,6 +1546,12 @@ void gl_segmented_rect_2d_fragment_tex(const LLRect& rect,
gGL.texCoord2f(u_max, 1.f);
gGL.vertex2fv((x_max + height_vec).mV);
+ gGL.texCoord2f(u_min, 1.f - border_uv_scale.mV[VY]);
+ gGL.vertex2fv((x_min + height_vec - border_height_top).mV);
+
+ gGL.texCoord2f(u_max, 1.f);
+ gGL.vertex2fv((x_max + height_vec).mV);
+
gGL.texCoord2f(u_min, 1.f);
gGL.vertex2fv((x_min + height_vec).mV);
}
@@ -1332,7 +1566,7 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
// draw bottom left
gGL.texCoord2f(clip_rect.mLeft, clip_rect.mBottom);
@@ -1344,6 +1578,12 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mBottom);
gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mBottom * height_vec).mV);
+ gGL.texCoord2f(clip_rect.mLeft, clip_rect.mBottom);
+ gGL.vertex3f(0.f, 0.f, 0.f);
+
+ gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mBottom);
+ gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mBottom * height_vec).mV);
+
gGL.texCoord2f(clip_rect.mLeft, center_uv_rect.mBottom);
gGL.vertex3fv((center_draw_rect.mBottom * height_vec).mV);
@@ -1357,6 +1597,12 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mBottom);
gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mBottom * height_vec).mV);
+ gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mBottom);
+ gGL.vertex3fv((center_draw_rect.mLeft * width_vec).mV);
+
+ gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mBottom);
+ gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mBottom * height_vec).mV);
+
gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mBottom);
gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mBottom * height_vec).mV);
@@ -1370,6 +1616,12 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
gGL.texCoord2f(clip_rect.mRight, center_uv_rect.mBottom);
gGL.vertex3fv((width_vec + center_draw_rect.mBottom * height_vec).mV);
+ gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mBottom);
+ gGL.vertex3fv((center_draw_rect.mRight * width_vec).mV);
+
+ gGL.texCoord2f(clip_rect.mRight, center_uv_rect.mBottom);
+ gGL.vertex3fv((width_vec + center_draw_rect.mBottom * height_vec).mV);
+
gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mBottom);
gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mBottom * height_vec).mV);
@@ -1383,6 +1635,12 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop);
gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV);
+ gGL.texCoord2f(clip_rect.mLeft, center_uv_rect.mBottom);
+ gGL.vertex3fv((center_draw_rect.mBottom * height_vec).mV);
+
+ gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop);
+ gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV);
+
gGL.texCoord2f(clip_rect.mLeft, center_uv_rect.mTop);
gGL.vertex3fv((center_draw_rect.mTop * height_vec).mV);
@@ -1396,6 +1654,12 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop);
gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mTop * height_vec).mV);
+ gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mBottom);
+ gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mBottom * height_vec).mV);
+
+ gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop);
+ gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mTop * height_vec).mV);
+
gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop);
gGL.vertex3fv((center_draw_rect.mLeft * width_vec + center_draw_rect.mTop * height_vec).mV);
@@ -1409,6 +1673,12 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
gGL.texCoord2f(clip_rect.mRight, center_uv_rect.mTop);
gGL.vertex3fv((width_vec + center_draw_rect.mTop * height_vec).mV);
+ gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mBottom);
+ gGL.vertex3fv((center_draw_rect.mRight* width_vec + center_draw_rect.mBottom * height_vec).mV);
+
+ gGL.texCoord2f(clip_rect.mRight, center_uv_rect.mTop);
+ gGL.vertex3fv((width_vec + center_draw_rect.mTop * height_vec).mV);
+
gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop);
gGL.vertex3fv((center_draw_rect.mRight * width_vec + center_draw_rect.mTop * height_vec).mV);
@@ -1422,6 +1692,12 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mTop);
gGL.vertex3fv((center_draw_rect.mLeft * width_vec + height_vec).mV);
+ gGL.texCoord2f(clip_rect.mLeft, center_uv_rect.mTop);
+ gGL.vertex3fv((center_draw_rect.mTop* height_vec).mV);
+
+ gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop);
+ gGL.vertex3fv((center_draw_rect.mLeft* width_vec + center_draw_rect.mTop * height_vec).mV);
+
gGL.texCoord2f(clip_rect.mLeft, clip_rect.mTop);
gGL.vertex3fv((height_vec).mV);
@@ -1435,6 +1711,12 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mTop);
gGL.vertex3fv((center_draw_rect.mRight * width_vec + height_vec).mV);
+ gGL.texCoord2f(center_uv_rect.mLeft, center_uv_rect.mTop);
+ gGL.vertex3fv((center_draw_rect.mLeft* width_vec + center_draw_rect.mTop * height_vec).mV);
+
+ gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop);
+ gGL.vertex3fv((center_draw_rect.mRight* width_vec + center_draw_rect.mTop * height_vec).mV);
+
gGL.texCoord2f(center_uv_rect.mLeft, clip_rect.mTop);
gGL.vertex3fv((center_draw_rect.mLeft * width_vec + height_vec).mV);
@@ -1448,6 +1730,12 @@ void gl_segmented_rect_3d_tex(const LLRectf& clip_rect, const LLRectf& center_uv
gGL.texCoord2f(clip_rect.mRight, clip_rect.mTop);
gGL.vertex3fv((width_vec + height_vec).mV);
+ gGL.texCoord2f(center_uv_rect.mRight, center_uv_rect.mTop);
+ gGL.vertex3fv((center_draw_rect.mRight* width_vec + center_draw_rect.mTop * height_vec).mV);
+
+ gGL.texCoord2f(clip_rect.mRight, clip_rect.mTop);
+ gGL.vertex3fv((width_vec + height_vec).mV);
+
gGL.texCoord2f(center_uv_rect.mRight, clip_rect.mTop);
gGL.vertex3fv((center_draw_rect.mRight * width_vec + height_vec).mV);
}
diff --git a/indra/llrender/llrendersphere.cpp b/indra/llrender/llrendersphere.cpp
index 9570180554..cd8ef7d68e 100644
--- a/indra/llrender/llrendersphere.cpp
+++ b/indra/llrender/llrendersphere.cpp
@@ -34,6 +34,8 @@
#include "llerror.h"
#include "llglheaders.h"
+#include "llvertexbuffer.h"
+#include "llglslshader.h"
LLRenderSphere gSphere;
@@ -53,12 +55,20 @@ inline LLVector3 polar_to_cart(F32 latitude, F32 longitude)
void LLRenderSphere::renderGGL()
{
+ LL_PROFILE_ZONE_SCOPED;
S32 const LATITUDE_SLICES = 20;
S32 const LONGITUDE_SLICES = 30;
- if (mSpherePoints.empty())
+ if (mVertexBuffer.isNull())
{
mSpherePoints.resize(LATITUDE_SLICES + 1);
+ mVertexBuffer = new LLVertexBuffer(LLVertexBuffer::MAP_VERTEX);
+
+ mVertexBuffer->allocateBuffer((U32)(LATITUDE_SLICES + 1) * (LONGITUDE_SLICES + 1), LATITUDE_SLICES * LONGITUDE_SLICES * 6);
+
+ LLStrider<LLVector3> v;
+ mVertexBuffer->getVertexStrider(v);
+
for (S32 lat_i = 0; lat_i < LATITUDE_SLICES + 1; lat_i++)
{
mSpherePoints[lat_i].resize(LONGITUDE_SLICES + 1);
@@ -68,24 +78,52 @@ void LLRenderSphere::renderGGL()
F32 lon = (F32)lon_i / LONGITUDE_SLICES;
mSpherePoints[lat_i][lon_i] = polar_to_cart(lat, lon);
+ v[lat_i * (LONGITUDE_SLICES + 1) + lon_i] = mSpherePoints[lat_i][lon_i];
}
}
+
+ LLStrider<U16> i;
+ mVertexBuffer->getIndexStrider(i);
+
+ for (S32 lat_i = 0; lat_i < LATITUDE_SLICES; lat_i++)
+ {
+ for (S32 lon_i = 0; lon_i < LONGITUDE_SLICES; lon_i++)
+ {
+ i[(lat_i * LONGITUDE_SLICES + lon_i) * 6 + 0] = lat_i * (LONGITUDE_SLICES + 1) + lon_i;
+ i[(lat_i * LONGITUDE_SLICES + lon_i) * 6 + 1] = lat_i * (LONGITUDE_SLICES + 1) + lon_i + 1;
+ i[(lat_i * LONGITUDE_SLICES + lon_i) * 6 + 2] = (lat_i + 1) * (LONGITUDE_SLICES + 1) + lon_i;
+
+ i[(lat_i * LONGITUDE_SLICES + lon_i) * 6 + 3] = (lat_i + 1) * (LONGITUDE_SLICES + 1) + lon_i;
+ i[(lat_i * LONGITUDE_SLICES + lon_i) * 6 + 4] = lat_i * (LONGITUDE_SLICES + 1) + lon_i + 1;
+ i[(lat_i * LONGITUDE_SLICES + lon_i) * 6 + 5] = (lat_i + 1) * (LONGITUDE_SLICES + 1) + lon_i + 1;
+ }
+ }
+
+ mVertexBuffer->unmapBuffer();
}
- gGL.begin(LLRender::TRIANGLES);
- for (S32 lat_i = 0; lat_i < LATITUDE_SLICES; lat_i++)
- {
- for (S32 lon_i = 0; lon_i < LONGITUDE_SLICES; lon_i++)
+ if (LLGLSLShader::sCurBoundShaderPtr->mAttributeMask == LLVertexBuffer::MAP_VERTEX)
+ { // shader expects only vertex positions in vertex buffer, use fast path
+ mVertexBuffer->setBuffer();
+ mVertexBuffer->drawRange(LLRender::TRIANGLES, 0, mVertexBuffer->getNumVerts(), mVertexBuffer->getNumIndices(), 0);
+ }
+ else
+ { //shader wants colors in the vertex stream, use slow path
+ gGL.begin(LLRender::TRIANGLES);
+ for (S32 lat_i = 0; lat_i < LATITUDE_SLICES; lat_i++)
{
- gGL.vertex3fv(mSpherePoints[lat_i][lon_i].mV);
- gGL.vertex3fv(mSpherePoints[lat_i][lon_i+1].mV);
- gGL.vertex3fv(mSpherePoints[lat_i+1][lon_i].mV);
+ for (S32 lon_i = 0; lon_i < LONGITUDE_SLICES; lon_i++)
+ {
+ gGL.vertex3fv(mSpherePoints[lat_i][lon_i].mV);
+ gGL.vertex3fv(mSpherePoints[lat_i][lon_i + 1].mV);
+ gGL.vertex3fv(mSpherePoints[lat_i + 1][lon_i].mV);
- gGL.vertex3fv(mSpherePoints[lat_i+1][lon_i].mV);
- gGL.vertex3fv(mSpherePoints[lat_i][lon_i+1].mV);
- gGL.vertex3fv(mSpherePoints[lat_i+1][lon_i+1].mV);
+ gGL.vertex3fv(mSpherePoints[lat_i + 1][lon_i].mV);
+ gGL.vertex3fv(mSpherePoints[lat_i][lon_i + 1].mV);
+ gGL.vertex3fv(mSpherePoints[lat_i + 1][lon_i + 1].mV);
+ }
}
+ gGL.end();
}
- gGL.end();
}
diff --git a/indra/llrender/llrendersphere.h b/indra/llrender/llrendersphere.h
index e2e886fa06..5b6eabecb8 100644
--- a/indra/llrender/llrendersphere.h
+++ b/indra/llrender/llrendersphere.h
@@ -45,6 +45,7 @@ public:
private:
std::vector< std::vector<LLVector3> > mSpherePoints;
+ LLPointer<LLVertexBuffer> mVertexBuffer;
};
extern LLRenderSphere gSphere;
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index 8524b470de..6f4828397a 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -289,22 +289,58 @@ static GLuint gen_buffer()
return ret;
}
-#define ANALYZE_VBO_POOL 0
+static void delete_buffers(S32 count, GLuint* buffers)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX;
+ // wait a few frames before actually deleting the buffers to avoid
+ // synchronization issues with the GPU
+ static std::vector<GLuint> sFreeList[4];
+
+ if (gGLManager.mInited)
+ {
+ U32 idx = LLImageGL::sFrameCount % 4;
-#if LL_DARWIN
+ for (S32 i = 0; i < count; ++i)
+ {
+ sFreeList[idx].push_back(buffers[i]);
+ }
+
+ idx = (LLImageGL::sFrameCount + 3) % 4;
-// experimental -- disable VBO pooling on OS X and use glMapBuffer
+ if (!sFreeList[idx].empty())
+ {
+ glDeleteBuffers((GLsizei)sFreeList[idx].size(), sFreeList[idx].data());
+ sFreeList[idx].resize(0);
+ }
+ }
+}
+
+
+#define ANALYZE_VBO_POOL 0
+
+// VBO Pool interface
class LLVBOPool
{
+ public:
+ virtual ~LLVBOPool() = default;
+ virtual void allocate(GLenum type, U32 size, GLuint& name, U8*& data) = 0;
+ virtual void free(GLenum type, U32 size, GLuint name, U8* data) = 0;
+ virtual U64 getVramBytesUsed() = 0;
+};
+
+// VBO Pool for Apple GPUs (as in M1/M2 etc, not Intel macs)
+// Effectively disables VBO pooling
+class LLAppleVBOPool final: public LLVBOPool
+{
public:
U64 mAllocated = 0;
- U64 getVramBytesUsed()
+ U64 getVramBytesUsed() override
{
return mAllocated;
}
- void allocate(GLenum type, U32 size, GLuint& name, U8*& data)
+ void allocate(GLenum type, U32 size, GLuint& name, U8*& data) override
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX;
STOP_GLERROR;
@@ -324,7 +360,7 @@ public:
}
}
- void free(GLenum type, U32 size, GLuint name, U8* data)
+ void free(GLenum type, U32 size, GLuint name, U8* data) override
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX;
llassert(type == GL_ARRAY_BUFFER || type == GL_ELEMENT_ARRAY_BUFFER);
@@ -339,19 +375,17 @@ public:
STOP_GLERROR;
if (name)
{
- glDeleteBuffers(1, &name);
+ delete_buffers(1, &name);
}
STOP_GLERROR;
}
};
-#else
-
-class LLVBOPool
+// VBO Pool for GPUs that benefit from VBO pooling
+class LLDefaultVBOPool final : public LLVBOPool
{
public:
typedef std::chrono::steady_clock::time_point Time;
-
struct Entry
{
U8* mData;
@@ -359,7 +393,7 @@ public:
Time mAge;
};
- ~LLVBOPool()
+ ~LLDefaultVBOPool() override
{
clear();
}
@@ -377,7 +411,7 @@ public:
U32 mMisses = 0;
U32 mHits = 0;
- U64 getVramBytesUsed()
+ U64 getVramBytesUsed() override
{
return mAllocated + mReserved;
}
@@ -393,7 +427,7 @@ public:
size += block_size - (size % block_size);
}
- void allocate(GLenum type, U32 size, GLuint& name, U8*& data)
+ void allocate(GLenum type, U32 size, GLuint& name, U8*& data) override
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX;
llassert(type == GL_ARRAY_BUFFER || type == GL_ELEMENT_ARRAY_BUFFER);
@@ -449,7 +483,7 @@ public:
clean();
}
- void free(GLenum type, U32 size, GLuint name, U8* data)
+ void free(GLenum type, U32 size, GLuint name, U8* data) override
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX;
llassert(type == GL_ARRAY_BUFFER || type == GL_ELEMENT_ARRAY_BUFFER);
@@ -512,7 +546,7 @@ public:
LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vbo cache timeout");
auto& entry = entries.back();
ll_aligned_free_16(entry.mData);
- glDeleteBuffers(1, &entry.mGLName);
+ delete_buffers(1, &entry.mGLName);
llassert(mReserved >= iter->first);
mReserved -= iter->first;
entries.pop_back();
@@ -548,7 +582,7 @@ public:
for (auto& entry : entries.second)
{
ll_aligned_free_16(entry.mData);
- glDeleteBuffers(1, &entry.mGLName);
+ delete_buffers(1, &entry.mGLName);
}
}
@@ -557,7 +591,7 @@ public:
for (auto& entry : entries.second)
{
ll_aligned_free_16(entry.mData);
- glDeleteBuffers(1, &entry.mGLName);
+ delete_buffers(1, &entry.mGLName);
}
}
@@ -567,7 +601,6 @@ public:
mVBOPool.clear();
}
};
-#endif
static LLVBOPool* sVBOPool = nullptr;
@@ -600,15 +633,7 @@ void LLVertexBufferData::draw()
gGL.loadMatrix(glm::value_ptr(mTexture0));
mVB->setBuffer();
-
- if (mMode == LLRender::QUADS && LLRender::sGLCoreProfile)
- {
- mVB->drawArrays(LLRender::TRIANGLES, 0, mCount);
- }
- else
- {
- mVB->drawArrays(mMode, 0, mCount);
- }
+ mVB->drawArrays(mMode, 0, mCount);
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_PROJECTION);
@@ -681,7 +706,6 @@ const U32 LLVertexBuffer::sGLMode[LLRender::NUM_MODES] =
GL_POINTS,
GL_LINES,
GL_LINE_STRIP,
- GL_QUADS,
GL_LINE_LOOP,
};
@@ -896,7 +920,16 @@ void LLVertexBuffer::drawArrays(U32 mode, U32 first, U32 count) const
void LLVertexBuffer::initClass(LLWindow* window)
{
llassert(sVBOPool == nullptr);
- sVBOPool = new LLVBOPool();
+ if (gGLManager.mIsApple)
+ {
+ LL_INFOS() << "VBO Pooling Disabled" << LL_ENDL;
+ sVBOPool = new LLAppleVBOPool();
+ }
+ else
+ {
+ LL_INFOS() << "VBO Pooling Enabled" << LL_ENDL;
+ sVBOPool = new LLDefaultVBOPool();
+ }
#if ENABLE_GL_WORK_QUEUE
sQueue = new GLWorkQueue();
@@ -964,7 +997,6 @@ void LLVertexBuffer::flushBuffers()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VERTEX;
// must only be called from main thread
- llassert(LLCoros::on_main_thread_main_coro());
for (auto& buffer : sMappedBuffers)
{
buffer->_unmapBuffer();
@@ -1231,28 +1263,29 @@ U8* LLVertexBuffer::mapVertexBuffer(LLVertexBuffer::AttributeType type, U32 inde
count = mNumVerts - index;
}
-#if !LL_DARWIN
- U32 start = mOffsets[type] + sTypeSize[type] * index;
- U32 end = start + sTypeSize[type] * count-1;
-
- bool flagged = false;
- // flag region as mapped
- for (U32 i = 0; i < mMappedVertexRegions.size(); ++i)
+ if (!gGLManager.mIsApple)
{
- MappedRegion& region = mMappedVertexRegions[i];
- if (expand_region(region, start, end))
+ U32 start = mOffsets[type] + sTypeSize[type] * index;
+ U32 end = start + sTypeSize[type] * count-1;
+
+ bool flagged = false;
+ // flag region as mapped
+ for (U32 i = 0; i < mMappedVertexRegions.size(); ++i)
{
- flagged = true;
- break;
+ MappedRegion& region = mMappedVertexRegions[i];
+ if (expand_region(region, start, end))
+ {
+ flagged = true;
+ break;
+ }
}
- }
- if (!flagged)
- {
- //didn't expand an existing region, make a new one
- mMappedVertexRegions.push_back({ start, end });
+ if (!flagged)
+ {
+ //didn't expand an existing region, make a new one
+ mMappedVertexRegions.push_back({ start, end });
+ }
}
-#endif
return mMappedData+mOffsets[type]+sTypeSize[type]*index;
}
@@ -1267,28 +1300,29 @@ U8* LLVertexBuffer::mapIndexBuffer(U32 index, S32 count)
count = mNumIndices-index;
}
-#if !LL_DARWIN
- U32 start = sizeof(U16) * index;
- U32 end = start + sizeof(U16) * count-1;
-
- bool flagged = false;
- // flag region as mapped
- for (U32 i = 0; i < mMappedIndexRegions.size(); ++i)
+ if (!gGLManager.mIsApple)
{
- MappedRegion& region = mMappedIndexRegions[i];
- if (expand_region(region, start, end))
+ U32 start = sizeof(U16) * index;
+ U32 end = start + sizeof(U16) * count-1;
+
+ bool flagged = false;
+ // flag region as mapped
+ for (U32 i = 0; i < mMappedIndexRegions.size(); ++i)
{
- flagged = true;
- break;
+ MappedRegion& region = mMappedIndexRegions[i];
+ if (expand_region(region, start, end))
+ {
+ flagged = true;
+ break;
+ }
}
- }
- if (!flagged)
- {
- //didn't expand an existing region, make a new one
- mMappedIndexRegions.push_back({ start, end });
+ if (!flagged)
+ {
+ //didn't expand an existing region, make a new one
+ mMappedIndexRegions.push_back({ start, end });
+ }
}
-#endif
return mMappedIndexData + sizeof(U16)*index;
}
@@ -1301,34 +1335,40 @@ U8* LLVertexBuffer::mapIndexBuffer(U32 index, S32 count)
// dst -- mMappedData or mMappedIndexData
void LLVertexBuffer::flush_vbo(GLenum target, U32 start, U32 end, void* data, U8* dst)
{
-#if LL_DARWIN
- LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb memcpy");
- STOP_GLERROR;
- // copy into mapped buffer
- memcpy(dst+start, data, end-start+1);
-#else
- llassert(target == GL_ARRAY_BUFFER ? sGLRenderBuffer == mGLBuffer : sGLRenderIndices == mGLIndices);
-
- // skip mapped data and stream to GPU via glBufferSubData
- if (end != 0)
+ if (gGLManager.mIsApple)
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("glBufferSubData");
- LL_PROFILE_ZONE_NUM(start);
- LL_PROFILE_ZONE_NUM(end);
- LL_PROFILE_ZONE_NUM(end-start);
-
- constexpr U32 block_size = 65536;
+ // on OS X, flush_vbo doesn't actually write to the GL buffer, so be sure to call
+ // _mapBuffer to tag the buffer for flushing to GL
+ _mapBuffer();
+ LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("vb memcpy");
+ STOP_GLERROR;
+ // copy into mapped buffer
+ memcpy(dst+start, data, end-start+1);
+ }
+ else
+ {
+ llassert(target == GL_ARRAY_BUFFER ? sGLRenderBuffer == mGLBuffer : sGLRenderIndices == mGLIndices);
- for (U32 i = start; i <= end; i += block_size)
+ // skip mapped data and stream to GPU via glBufferSubData
+ if (end != 0)
{
- //LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("glBufferSubData block");
- //LL_PROFILE_GPU_ZONE("glBufferSubData");
- U32 tend = llmin(i + block_size, end);
- U32 size = tend - i + 1;
- glBufferSubData(target, i, size, (U8*) data + (i-start));
+ LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("glBufferSubData");
+ LL_PROFILE_ZONE_NUM(start);
+ LL_PROFILE_ZONE_NUM(end);
+ LL_PROFILE_ZONE_NUM(end-start);
+
+ constexpr U32 block_size = 65536;
+
+ for (U32 i = start; i <= end; i += block_size)
+ {
+ //LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("glBufferSubData block");
+ //LL_PROFILE_GPU_ZONE("glBufferSubData");
+ U32 tend = llmin(i + block_size, end);
+ U32 size = tend - i + 1;
+ glBufferSubData(target, i, size, (U8*) data + (i-start));
+ }
}
}
-#endif
}
void LLVertexBuffer::unmapBuffer()
@@ -1338,8 +1378,6 @@ void LLVertexBuffer::unmapBuffer()
void LLVertexBuffer::_mapBuffer()
{
- // must only be called from main thread
- llassert(LLCoros::on_main_thread_main_coro());
if (!mMapped)
{
mMapped = true;
@@ -1363,114 +1401,116 @@ void LLVertexBuffer::_unmapBuffer()
}
};
-#if LL_DARWIN
- STOP_GLERROR;
- if (mMappedData)
- {
- if (mGLBuffer)
- {
- glDeleteBuffers(1, &mGLBuffer);
- }
- mGLBuffer = gen_buffer();
- glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer);
- sGLRenderBuffer = mGLBuffer;
- glBufferData(GL_ARRAY_BUFFER, mSize, mMappedData, GL_STATIC_DRAW);
- }
- else if (mGLBuffer != sGLRenderBuffer)
+ if (gGLManager.mIsApple)
{
- glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer);
- sGLRenderBuffer = mGLBuffer;
- }
- STOP_GLERROR;
-
- if (mMappedIndexData)
- {
- if (mGLIndices)
+ STOP_GLERROR;
+ if (mMappedData)
{
- glDeleteBuffers(1, &mGLIndices);
+ if (mGLBuffer)
+ {
+ delete_buffers(1, &mGLBuffer);
+ }
+ mGLBuffer = gen_buffer();
+ glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer);
+ sGLRenderBuffer = mGLBuffer;
+ glBufferData(GL_ARRAY_BUFFER, mSize, mMappedData, GL_STATIC_DRAW);
}
-
- mGLIndices = gen_buffer();
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices);
- sGLRenderIndices = mGLIndices;
-
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, mIndicesSize, mMappedIndexData, GL_STATIC_DRAW);
- }
- else if (mGLIndices != sGLRenderIndices)
- {
- glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices);
- sGLRenderIndices = mGLIndices;
- }
- STOP_GLERROR;
-#else
-
- if (!mMappedVertexRegions.empty())
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("unmapBuffer - vertex");
-
- if (sGLRenderBuffer != mGLBuffer)
+ else if (mGLBuffer != sGLRenderBuffer)
{
glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer);
sGLRenderBuffer = mGLBuffer;
}
+ STOP_GLERROR;
- U32 start = 0;
- U32 end = 0;
-
- std::sort(mMappedVertexRegions.begin(), mMappedVertexRegions.end(), SortMappedRegion());
-
- for (U32 i = 0; i < mMappedVertexRegions.size(); ++i)
+ if (mMappedIndexData)
{
- const MappedRegion& region = mMappedVertexRegions[i];
- if (region.mStart == end + 1)
+ if (mGLIndices)
{
- end = region.mEnd;
+ delete_buffers(1, &mGLIndices);
}
- else
- {
- flush_vbo(GL_ARRAY_BUFFER, start, end, (U8*)mMappedData + start, mMappedData);
- start = region.mStart;
- end = region.mEnd;
- }
- }
- flush_vbo(GL_ARRAY_BUFFER, start, end, (U8*)mMappedData + start, mMappedData);
- mMappedVertexRegions.clear();
- }
-
- if (!mMappedIndexRegions.empty())
- {
- LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("unmapBuffer - index");
+ mGLIndices = gen_buffer();
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices);
+ sGLRenderIndices = mGLIndices;
- if (mGLIndices != sGLRenderIndices)
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, mIndicesSize, mMappedIndexData, GL_STATIC_DRAW);
+ }
+ else if (mGLIndices != sGLRenderIndices)
{
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices);
sGLRenderIndices = mGLIndices;
}
- U32 start = 0;
- U32 end = 0;
+ STOP_GLERROR;
+ }
+ else
+ {
+ if (!mMappedVertexRegions.empty())
+ {
+ LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("unmapBuffer - vertex");
- std::sort(mMappedIndexRegions.begin(), mMappedIndexRegions.end(), SortMappedRegion());
+ if (sGLRenderBuffer != mGLBuffer)
+ {
+ glBindBuffer(GL_ARRAY_BUFFER, mGLBuffer);
+ sGLRenderBuffer = mGLBuffer;
+ }
- for (U32 i = 0; i < mMappedIndexRegions.size(); ++i)
+ U32 start = 0;
+ U32 end = 0;
+
+ std::sort(mMappedVertexRegions.begin(), mMappedVertexRegions.end(), SortMappedRegion());
+
+ for (U32 i = 0; i < mMappedVertexRegions.size(); ++i)
+ {
+ const MappedRegion& region = mMappedVertexRegions[i];
+ if (region.mStart == end + 1)
+ {
+ end = region.mEnd;
+ }
+ else
+ {
+ flush_vbo(GL_ARRAY_BUFFER, start, end, (U8*)mMappedData + start, mMappedData);
+ start = region.mStart;
+ end = region.mEnd;
+ }
+ }
+
+ flush_vbo(GL_ARRAY_BUFFER, start, end, (U8*)mMappedData + start, mMappedData);
+ mMappedVertexRegions.clear();
+ }
+
+ if (!mMappedIndexRegions.empty())
{
- const MappedRegion& region = mMappedIndexRegions[i];
- if (region.mStart == end + 1)
+ LL_PROFILE_ZONE_NAMED_CATEGORY_VERTEX("unmapBuffer - index");
+
+ if (mGLIndices != sGLRenderIndices)
{
- end = region.mEnd;
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mGLIndices);
+ sGLRenderIndices = mGLIndices;
}
- else
+ U32 start = 0;
+ U32 end = 0;
+
+ std::sort(mMappedIndexRegions.begin(), mMappedIndexRegions.end(), SortMappedRegion());
+
+ for (U32 i = 0; i < mMappedIndexRegions.size(); ++i)
{
- flush_vbo(GL_ELEMENT_ARRAY_BUFFER, start, end, (U8*)mMappedIndexData + start, mMappedIndexData);
- start = region.mStart;
- end = region.mEnd;
+ const MappedRegion& region = mMappedIndexRegions[i];
+ if (region.mStart == end + 1)
+ {
+ end = region.mEnd;
+ }
+ else
+ {
+ flush_vbo(GL_ELEMENT_ARRAY_BUFFER, start, end, (U8*)mMappedIndexData + start, mMappedIndexData);
+ start = region.mStart;
+ end = region.mEnd;
+ }
}
- }
- flush_vbo(GL_ELEMENT_ARRAY_BUFFER, start, end, (U8*)mMappedIndexData + start, mMappedIndexData);
- mMappedIndexRegions.clear();
+ flush_vbo(GL_ELEMENT_ARRAY_BUFFER, start, end, (U8*)mMappedIndexData + start, mMappedIndexData);
+ mMappedIndexRegions.clear();
+ }
}
-#endif
}
//----------------------------------------------------------------------------
@@ -1592,12 +1632,6 @@ bool LLVertexBuffer::getClothWeightStrider(LLStrider<LLVector4>& strider, U32 in
void LLVertexBuffer::setBuffer()
{
STOP_GLERROR;
-#if LL_DARWIN
- if (!mGLBuffer)
- { // OS X doesn't allocate a buffer until we call unmapBuffer
- return;
- }
-#endif
if (mMapped)
{
diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp
index c6654ee0aa..42b6f1f07b 100644
--- a/indra/llui/llbadge.cpp
+++ b/indra/llui/llbadge.cpp
@@ -204,13 +204,13 @@ void renderBadgeBackground(F32 centerX, F32 centerY, F32 width, F32 height, cons
(F32)ll_round(x) + width,
(F32)ll_round(y) + height);
- LLVector3 vertices[4];
- vertices[0] = LLVector3(screen_rect.mRight, screen_rect.mTop, 1.0f);
- vertices[1] = LLVector3(screen_rect.mLeft, screen_rect.mTop, 1.0f);
- vertices[2] = LLVector3(screen_rect.mLeft, screen_rect.mBottom, 1.0f);
- vertices[3] = LLVector3(screen_rect.mRight, screen_rect.mBottom, 1.0f);
+ LLVector4a vertices[4];
+ vertices[0].set(screen_rect.mLeft, screen_rect.mTop, 1.0f);
+ vertices[1].set(screen_rect.mRight, screen_rect.mTop, 1.0f);
+ vertices[2].set(screen_rect.mLeft, screen_rect.mBottom, 1.0f);
+ vertices[3].set(screen_rect.mRight, screen_rect.mBottom, 1.0f);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLE_STRIP);
{
gGL.vertexBatchPreTransformed(vertices, 4);
}
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 92fb4b75bf..4b904f09e0 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -2275,36 +2275,28 @@ void LLFloater::drawConeToOwner(F32 &context_cone_opacity,
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
LLGLEnable(GL_CULL_FACE);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLE_STRIP);
{
gGL.color4f(0.f, 0.f, 0.f, contex_cone_in_alpha * context_cone_opacity);
gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop);
- gGL.vertex2i(owner_rect.mRight, owner_rect.mTop);
- gGL.color4f(0.f, 0.f, 0.f, contex_cone_out_alpha * context_cone_opacity);
- gGL.vertex2i(local_rect.mRight, local_rect.mTop);
- gGL.vertex2i(local_rect.mLeft, local_rect.mTop);
-
gGL.color4f(0.f, 0.f, 0.f, contex_cone_out_alpha * context_cone_opacity);
gGL.vertex2i(local_rect.mLeft, local_rect.mTop);
- gGL.vertex2i(local_rect.mLeft, local_rect.mBottom);
gGL.color4f(0.f, 0.f, 0.f, contex_cone_in_alpha * context_cone_opacity);
- gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom);
- gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop);
-
+ gGL.vertex2i(owner_rect.mRight, owner_rect.mTop);
gGL.color4f(0.f, 0.f, 0.f, contex_cone_out_alpha * context_cone_opacity);
- gGL.vertex2i(local_rect.mRight, local_rect.mBottom);
gGL.vertex2i(local_rect.mRight, local_rect.mTop);
gGL.color4f(0.f, 0.f, 0.f, contex_cone_in_alpha * context_cone_opacity);
- gGL.vertex2i(owner_rect.mRight, owner_rect.mTop);
gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom);
-
-
gGL.color4f(0.f, 0.f, 0.f, contex_cone_out_alpha * context_cone_opacity);
- gGL.vertex2i(local_rect.mLeft, local_rect.mBottom);
gGL.vertex2i(local_rect.mRight, local_rect.mBottom);
gGL.color4f(0.f, 0.f, 0.f, contex_cone_in_alpha * context_cone_opacity);
- gGL.vertex2i(owner_rect.mRight, owner_rect.mBottom);
gGL.vertex2i(owner_rect.mLeft, owner_rect.mBottom);
+ gGL.color4f(0.f, 0.f, 0.f, contex_cone_out_alpha * context_cone_opacity);
+ gGL.vertex2i(local_rect.mLeft, local_rect.mBottom);
+ gGL.color4f(0.f, 0.f, 0.f, contex_cone_in_alpha * context_cone_opacity);
+ gGL.vertex2i(owner_rect.mLeft, owner_rect.mTop);
+ gGL.color4f(0.f, 0.f, 0.f, contex_cone_out_alpha * context_cone_opacity);
+ gGL.vertex2i(local_rect.mLeft, local_rect.mTop);
}
gGL.end();
}
diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp
index 388dc5b1ac..42a9e267d2 100644
--- a/indra/llui/llfolderview.cpp
+++ b/indra/llui/llfolderview.cpp
@@ -1649,7 +1649,7 @@ void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constr
{
LLRect local_rect = item->getLocalRect();
S32 icon_height = mIcon.isNull() ? 0 : mIcon->getHeight();
- S32 label_height = getLabelFontForStyle(mLabelStyle)->getLineHeight();
+ S32 label_height = getLabelFont()->getLineHeight();
// when navigating with keyboard, only move top of opened folder on screen, otherwise show whole folder
S32 max_height_to_show = item->isOpen() && mScrollContainer->hasFocus() ? (llmax( icon_height, label_height ) + item->getIconPad()) : local_rect.getHeight();
diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp
index 73803786a6..18bde344a0 100644
--- a/indra/llui/llfolderviewitem.cpp
+++ b/indra/llui/llfolderviewitem.cpp
@@ -48,7 +48,6 @@ static LLDefaultChildRegistry::Register<LLFolderViewItem> r("folder_view_item");
// statics
std::map<U8, LLFontGL*> LLFolderViewItem::sFonts; // map of styles to fonts
-bool LLFolderViewItem::sColorSetInitialized = false;
LLUIColor LLFolderViewItem::sFgColor;
LLUIColor LLFolderViewItem::sHighlightBgColor;
LLUIColor LLFolderViewItem::sFlashBgColor;
@@ -58,6 +57,10 @@ LLUIColor LLFolderViewItem::sFilterBGColor;
LLUIColor LLFolderViewItem::sFilterTextColor;
LLUIColor LLFolderViewItem::sSuffixColor;
LLUIColor LLFolderViewItem::sSearchStatusColor;
+S32 LLFolderViewItem::sTopPad = 0;
+LLUIImagePtr LLFolderViewItem::sFolderArrowImg;
+LLUIImagePtr LLFolderViewItem::sSelectionImg;
+LLFontGL* LLFolderViewItem::sSuffixFont = nullptr;
// only integers can be initialized in header
const F32 LLFolderViewItem::FOLDER_CLOSE_TIME_CONSTANT = 0.02f;
@@ -83,15 +86,42 @@ LLFontGL* LLFolderViewItem::getLabelFontForStyle(U8 style)
return rtn;
}
+
+const LLFontGL* LLFolderViewItem::getLabelFont()
+{
+ if (!pLabelFont)
+ {
+ pLabelFont = getLabelFontForStyle(mLabelStyle);
+ }
+ return pLabelFont;
+}
//static
void LLFolderViewItem::initClass()
{
+ const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
+ sTopPad = default_params.item_top_pad;
+ sFolderArrowImg = default_params.folder_arrow_image;
+ sSelectionImg = default_params.selection_image;
+ sSuffixFont = getLabelFontForStyle(LLFontGL::NORMAL);
+
+ sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
+ sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
+ sFlashBgColor = LLUIColorTable::instance().getColor("MenuItemFlashBgColor", DEFAULT_WHITE);
+ sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE);
+ sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE);
+ sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE);
+ sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE);
+ sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE);
+ sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);
}
//static
void LLFolderViewItem::cleanupClass()
{
sFonts.clear();
+ sFolderArrowImg = nullptr;
+ sSelectionImg = nullptr;
+ sSuffixFont = nullptr;
}
@@ -134,6 +164,7 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
mIsItemCut(false),
mCutGeneration(0),
mLabelStyle( LLFontGL::NORMAL ),
+ pLabelFont(nullptr),
mHasVisibleChildren(false),
mLocalIndentation(p.folder_indentation),
mIndentation(0),
@@ -158,20 +189,6 @@ LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
mMaxFolderItemOverlap(p.max_folder_item_overlap),
mDoubleClickOverride(p.double_click_override)
{
- if (!sColorSetInitialized)
- {
- sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
- sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
- sFlashBgColor = LLUIColorTable::instance().getColor("MenuItemFlashBgColor", DEFAULT_WHITE);
- sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE);
- sMouseOverColor = LLUIColorTable::instance().getColor("InventoryMouseOverColor", DEFAULT_WHITE);
- sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE);
- sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE);
- sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemLinkColor", DEFAULT_WHITE);
- sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);
- sColorSetInitialized = true;
- }
-
if (mViewModelItem)
{
mViewModelItem->setFolderViewItem(this);
@@ -320,6 +337,7 @@ void LLFolderViewItem::refresh()
// Very Expensive!
// Can do a number of expensive checks, like checking active motions, wearables or friend list
mLabelStyle = vmi.getLabelStyle();
+ pLabelFont = nullptr; // refresh can be called from a coro, don't use getLabelFontForStyle, coro trips font list tread safety
mLabelSuffix = utf8str_to_wstring(vmi.getLabelSuffix());
mSuffixFontBuffer.reset();
}
@@ -346,6 +364,7 @@ void LLFolderViewItem::refreshSuffix()
// Very Expensive!
// Can do a number of expensive checks, like checking active motions, wearables or friend list
mLabelStyle = vmi->getLabelStyle();
+ pLabelFont = nullptr;
mLabelSuffix = utf8str_to_wstring(vmi->getLabelSuffix());
}
@@ -738,19 +757,17 @@ bool LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
return handled;
}
-void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const LLUIColor& fg_color)
+void LLFolderViewItem::drawOpenFolderArrow()
{
//--------------------------------------------------------------------------------//
// Draw open folder arrow
//
- const S32 TOP_PAD = default_params.item_top_pad;
if (hasVisibleChildren() || !isFolderComplete())
{
- LLUIImage* arrow_image = default_params.folder_arrow_image;
gl_draw_scaled_rotated_image(
- mIndentation, getRect().getHeight() - mArrowSize - mTextPad - TOP_PAD,
- mArrowSize, mArrowSize, mControlLabelRotation, arrow_image->getImage(), fg_color);
+ mIndentation, getRect().getHeight() - mArrowSize - mTextPad - sTopPad,
+ mArrowSize, mArrowSize, mControlLabelRotation, sFolderArrowImg->getImage(), sFgColor);
}
}
@@ -766,7 +783,7 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L
/*virtual*/ bool LLFolderViewItem::isFadeItem()
{
- LLClipboard& clipboard = LLClipboard::instance();
+ static const LLClipboard& clipboard = LLClipboard::instance(); // Make it a 'simpleton'?
if (mCutGeneration != clipboard.getGeneration())
{
mCutGeneration = clipboard.getGeneration();
@@ -902,16 +919,14 @@ void LLFolderViewItem::draw()
const bool show_context = (getRoot() ? getRoot()->getShowSelectionContext() : false);
const bool filled = show_context || (getRoot() ? getRoot()->getParentPanel()->hasFocus() : false); // If we have keyboard focus, draw selection filled
- const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
- const S32 TOP_PAD = default_params.item_top_pad;
-
- const LLFontGL* font = getLabelFontForStyle(mLabelStyle);
+ const LLFontGL* font = getLabelFont();
+ S32 line_height = font->getLineHeight();
getViewModelItem()->update();
if (!mSingleFolderMode)
{
- drawOpenFolderArrow(default_params, sFgColor);
+ drawOpenFolderArrow();
}
drawHighlight(show_context, filled, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor);
@@ -920,18 +935,19 @@ void LLFolderViewItem::draw()
// Draw open icon
//
const S32 icon_x = mIndentation + mArrowSize + mTextPad;
+ const S32 rect_height = getRect().getHeight();
if (!mIconOpen.isNull() && (llabs(mControlLabelRotation) > 80)) // For open folders
{
- mIconOpen->draw(icon_x, getRect().getHeight() - mIconOpen->getHeight() - TOP_PAD + 1);
+ mIconOpen->draw(icon_x, rect_height - mIconOpen->getHeight() - sTopPad + 1);
}
else if (mIcon)
{
- mIcon->draw(icon_x, getRect().getHeight() - mIcon->getHeight() - TOP_PAD + 1);
+ mIcon->draw(icon_x, rect_height - mIcon->getHeight() - sTopPad + 1);
}
if (mIconOverlay && getRoot()->showItemLinkOverlays())
{
- mIconOverlay->draw(icon_x, getRect().getHeight() - mIcon->getHeight() - TOP_PAD + 1);
+ mIconOverlay->draw(icon_x, rect_height - mIcon->getHeight() - sTopPad + 1);
}
//--------------------------------------------------------------------------------//
@@ -944,24 +960,22 @@ void LLFolderViewItem::draw()
S32 filter_string_length = mViewModelItem->hasFilterStringMatch() ? (S32)mViewModelItem->getFilterStringSize() : 0;
F32 right_x = 0;
- F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
+ F32 y = (F32)rect_height - line_height - (F32)mTextPad - (F32)sTopPad;
F32 text_left = (F32)getLabelXPos();
LLWString combined_string = mLabel + mLabelSuffix;
- const LLFontGL* suffix_font = getLabelFontForStyle(LLFontGL::NORMAL);
S32 filter_offset = static_cast<S32>(mViewModelItem->getFilterStringOffset());
if (filter_string_length > 0)
{
- S32 bottom = getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD;
- S32 top = getRect().getHeight() - TOP_PAD;
- if(mLabelSuffix.empty() || (font == suffix_font))
+ S32 bottom = rect_height - line_height - 3 - sTopPad;
+ S32 top = rect_height - sTopPad;
+ if(mLabelSuffix.empty() || (font == sSuffixFont))
{
- S32 left = ll_round(text_left) + font->getWidth(combined_string.c_str(), 0, static_cast<S32>(mViewModelItem->getFilterStringOffset())) - 2;
- S32 right = left + font->getWidth(combined_string.c_str(), static_cast<S32>(mViewModelItem->getFilterStringOffset()), filter_string_length) + 2;
+ S32 left = ll_round(text_left) + font->getWidth(combined_string.c_str(), 0, filter_offset) - 2;
+ S32 right = left + font->getWidth(combined_string.c_str(), filter_offset, filter_string_length) + 2;
- LLUIImage* box_image = default_params.selection_image;
- LLRect box_rect(left, top, right, bottom);
- box_image->draw(box_rect, sFilterBGColor);
+ LLRect box_rect(left, top, right, bottom);
+ sSelectionImg->draw(box_rect, sFilterBGColor);
}
else
{
@@ -970,19 +984,17 @@ void LLFolderViewItem::draw()
{
S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel.c_str(), 0, llmin(filter_offset, (S32)mLabel.size()))) - 2;
S32 right = left + (S32)font->getWidthF32(mLabel.c_str(), filter_offset, label_filter_length) + 2;
- LLUIImage* box_image = default_params.selection_image;
LLRect box_rect(left, top, right, bottom);
- box_image->draw(box_rect, sFilterBGColor);
+ sSelectionImg->draw(box_rect, sFilterBGColor);
}
S32 suffix_filter_length = label_filter_length > 0 ? filter_string_length - label_filter_length : filter_string_length;
if(suffix_filter_length > 0)
{
S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size());
- S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel.c_str(), 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix.c_str(), 0, suffix_offset)) - 2;
- S32 right = left + (S32)suffix_font->getWidthF32(mLabelSuffix.c_str(), suffix_offset, suffix_filter_length) + 2;
- LLUIImage* box_image = default_params.selection_image;
+ S32 left = (S32)(ll_round(text_left) + font->getWidthF32(mLabel.c_str(), 0, static_cast<S32>(mLabel.size())) + sSuffixFont->getWidthF32(mLabelSuffix.c_str(), 0, suffix_offset)) - 2;
+ S32 right = left + (S32)sSuffixFont->getWidthF32(mLabelSuffix.c_str(), suffix_offset, suffix_filter_length) + 2;
LLRect box_rect(left, top, right, bottom);
- box_image->draw(box_rect, sFilterBGColor);
+ sSelectionImg->draw(box_rect, sFilterBGColor);
}
}
}
@@ -1001,7 +1013,7 @@ void LLFolderViewItem::draw()
//
if (!mLabelSuffix.empty())
{
- mSuffixFontBuffer.render(suffix_font, mLabelSuffix, 0, right_x, y, isFadeItem() ? color : sSuffixColor.get(),
+ mSuffixFontBuffer.render(sSuffixFont, mLabelSuffix, 0, right_x, y, isFadeItem() ? color : sSuffixColor.get(),
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
S32_MAX, S32_MAX, &right_x);
}
@@ -1011,10 +1023,10 @@ void LLFolderViewItem::draw()
//
if (filter_string_length > 0)
{
- if(mLabelSuffix.empty() || (font == suffix_font))
+ if(mLabelSuffix.empty() || (font == sSuffixFont))
{
F32 match_string_left = text_left + font->getWidthF32(combined_string.c_str(), 0, filter_offset + filter_string_length) - font->getWidthF32(combined_string.c_str(), filter_offset, filter_string_length);
- F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
+ F32 yy = (F32)rect_height - line_height - (F32)mTextPad - (F32)sTopPad;
font->render(combined_string, filter_offset, match_string_left, yy,
sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
filter_string_length, S32_MAX, &right_x);
@@ -1025,7 +1037,7 @@ void LLFolderViewItem::draw()
if(label_filter_length > 0)
{
F32 match_string_left = text_left + font->getWidthF32(mLabel.c_str(), 0, filter_offset + label_filter_length) - font->getWidthF32(mLabel.c_str(), filter_offset, label_filter_length);
- F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
+ F32 yy = (F32)rect_height - line_height - (F32)mTextPad - (F32)sTopPad;
font->render(mLabel, filter_offset, match_string_left, yy,
sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
label_filter_length, S32_MAX, &right_x);
@@ -1035,9 +1047,9 @@ void LLFolderViewItem::draw()
if(suffix_filter_length > 0)
{
S32 suffix_offset = llmax(0, filter_offset - (S32)mLabel.size());
- F32 match_string_left = text_left + font->getWidthF32(mLabel.c_str(), 0, static_cast<S32>(mLabel.size())) + suffix_font->getWidthF32(mLabelSuffix.c_str(), 0, suffix_offset + suffix_filter_length) - suffix_font->getWidthF32(mLabelSuffix.c_str(), suffix_offset, suffix_filter_length);
- F32 yy = (F32)getRect().getHeight() - suffix_font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD;
- suffix_font->render(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor,
+ F32 match_string_left = text_left + font->getWidthF32(mLabel.c_str(), 0, static_cast<S32>(mLabel.size())) + sSuffixFont->getWidthF32(mLabelSuffix.c_str(), 0, suffix_offset + suffix_filter_length) - sSuffixFont->getWidthF32(mLabelSuffix.c_str(), suffix_offset, suffix_filter_length);
+ F32 yy = (F32)rect_height - sSuffixFont->getLineHeight() - (F32)mTextPad - (F32)sTopPad;
+ sSuffixFont->render(mLabelSuffix, suffix_offset, match_string_left, yy, sFilterTextColor,
LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
suffix_filter_length, S32_MAX, &right_x);
}
diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h
index 7ac28b1a8e..cc8a7d934c 100644
--- a/indra/llui/llfolderviewitem.h
+++ b/indra/llui/llfolderviewitem.h
@@ -135,7 +135,6 @@ protected:
LLUIColor mFontHighlightColor;
// For now assuming all colors are the same in derived classes.
- static bool sColorSetInitialized;
static LLUIColor sFgColor;
static LLUIColor sFgDisabledColor;
static LLUIColor sHighlightBgColor;
@@ -158,6 +157,7 @@ protected:
virtual void setFlashState(bool) { }
static LLFontGL* getLabelFontForStyle(U8 style);
+ const LLFontGL* getLabelFont();
bool mIsSelected;
@@ -297,7 +297,7 @@ public:
// virtual void handleDropped();
virtual void draw();
- void drawOpenFolderArrow(const Params& default_params, const LLUIColor& fg_color);
+ void drawOpenFolderArrow();
void drawHighlight(bool showContent, bool hasKeyboardFocus, const LLUIColor& selectColor, const LLUIColor& flashColor, const LLUIColor& outlineColor, const LLUIColor& mouseOverColor);
void drawLabel(const LLFontGL* font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x);
virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
@@ -308,9 +308,14 @@ public:
private:
static std::map<U8, LLFontGL*> sFonts; // map of styles to fonts
+ static S32 sTopPad;
+ static LLUIImagePtr sFolderArrowImg;
+ static LLUIImagePtr sSelectionImg;
+ static LLFontGL* sSuffixFont;
LLFontVertexBuffer mLabelFontBuffer;
LLFontVertexBuffer mSuffixFontBuffer;
+ LLFontGL* pLabelFont{nullptr};
};
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/indra/llui/llstatbar.cpp b/indra/llui/llstatbar.cpp
index 2693243eb1..62c0401869 100644
--- a/indra/llui/llstatbar.cpp
+++ b/indra/llui/llstatbar.cpp
@@ -460,7 +460,7 @@ void LLStatBar::draw()
max_value = 0.f;
gGL.color4f(1.f, 0.f, 0.f, 1.f);
- gGL.begin( LLRender::QUADS );
+ gGL.begin(LLRender::TRIANGLES);
const S32 max_frame = llmin(num_frames, num_values);
U32 num_samples = 0;
for (S32 i = 1; i <= max_frame; i++)
@@ -498,6 +498,9 @@ void LLStatBar::draw()
gGL.vertex2f((F32)bar_rect.mRight - offset, max);
gGL.vertex2f((F32)bar_rect.mRight - offset, min);
gGL.vertex2f((F32)bar_rect.mRight - offset - 1, min);
+
+ gGL.vertex2f((F32)bar_rect.mRight - offset, max);
+ gGL.vertex2f((F32)bar_rect.mRight - offset - 1, min);
gGL.vertex2f((F32)bar_rect.mRight - offset - 1, max);
}
else
@@ -505,7 +508,10 @@ void LLStatBar::draw()
gGL.vertex2f(min, (F32)bar_rect.mBottom + offset + 1);
gGL.vertex2f(min, (F32)bar_rect.mBottom + offset);
gGL.vertex2f(max, (F32)bar_rect.mBottom + offset);
- gGL.vertex2f(max, (F32)bar_rect.mBottom + offset + 1 );
+
+ gGL.vertex2f(min, (F32)bar_rect.mBottom + offset + 1);
+ gGL.vertex2f(max, (F32)bar_rect.mBottom + offset);
+ gGL.vertex2f(max, (F32)bar_rect.mBottom + offset + 1);
}
}
gGL.end();
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 32fafe3c52..1bfb137e0f 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -2368,6 +2368,34 @@ S32 LLTextBase::removeFirstLine()
return 0;
}
+// virtual
+void LLTextBase::copyContents(const LLTextBase* source)
+{
+ llassert(source);
+ if (!source)
+ return;
+
+ beforeValueChange();
+ deselect();
+
+ mSegments.clear();
+ for (const LLTextSegmentPtr& segp : source->mSegments)
+ {
+ mSegments.emplace(segp->clone(*this));
+ }
+
+ mLineInfoList.clear();
+ for (const line_info& li : mLineInfoList)
+ {
+ mLineInfoList.push_back(line_info(li));
+ }
+
+ getViewModel()->setDisplay(source->getViewModel()->getDisplay());
+
+ onValueChange(0, getLength());
+ needsReflow();
+}
+
void LLTextBase::appendLineBreakSegment(const LLStyle::Params& style_params)
{
segment_vec_t segments;
@@ -3233,6 +3261,24 @@ boost::signals2::connection LLTextBase::setIsObjectBlockedCallback(const is_bloc
LLTextSegment::~LLTextSegment()
{}
+// static
+LLStyleSP LLTextSegment::cloneStyle(LLTextBase& target, const LLStyle* source)
+{
+ // Take most params from target
+ LLStyle::Params params = target.getStyleParams();
+ LLStyle* style = new LLStyle(params);
+
+ // Take some params from source
+ style->setLinkHREF(source->getLinkHREF());
+ if (source->isImage())
+ {
+ style->setImage(source->getImage()->getName());
+ }
+
+ return style;
+}
+
+
bool LLTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const { width = 0; height = 0; return false; }
bool LLTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const
{
@@ -3574,6 +3620,13 @@ void LLNormalTextSegment::setToolTip(const std::string& tooltip)
mTooltip = tooltip;
}
+// virtual
+LLTextSegmentPtr LLNormalTextSegment::clone(LLTextBase& target) const
+{
+ LLStyleConstSP sp(cloneStyle(target, mStyle));
+ return new LLNormalTextSegment(sp, mStart, mEnd, target);
+}
+
bool LLNormalTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const
{
height = 0;
@@ -3701,6 +3754,13 @@ LLLabelTextSegment::LLLabelTextSegment( const LLUIColor& color, S32 start, S32 e
{
}
+// virtual
+LLTextSegmentPtr LLLabelTextSegment::clone(LLTextBase& target) const
+{
+ LLStyleConstSP sp(cloneStyle(target, mStyle));
+ return new LLLabelTextSegment(sp, mStart, mEnd, target);
+}
+
/*virtual*/
const LLWString& LLLabelTextSegment::getWText() const
{
@@ -3725,6 +3785,13 @@ LLEmojiTextSegment::LLEmojiTextSegment(const LLUIColor& color, S32 start, S32 en
{
}
+// virtual
+LLTextSegmentPtr LLEmojiTextSegment::clone(LLTextBase& target) const
+{
+ LLStyleConstSP sp(cloneStyle(target, mStyle));
+ return new LLEmojiTextSegment(sp, mStart, mEnd, target);
+}
+
bool LLEmojiTextSegment::handleToolTip(S32 x, S32 y, MASK mask)
{
if (mTooltip.empty())
@@ -3748,6 +3815,14 @@ LLOnHoverChangeableTextSegment::LLOnHoverChangeableTextSegment( LLStyleConstSP s
mHoveredStyle(style),
mNormalStyle(normal_style){}
+// virtual
+LLTextSegmentPtr LLOnHoverChangeableTextSegment::clone(LLTextBase& target) const
+{
+ LLStyleConstSP hsp(cloneStyle(target, mHoveredStyle));
+ LLStyleConstSP nsp(cloneStyle(target, mNormalStyle));
+ return new LLOnHoverChangeableTextSegment(hsp, nsp, mStart, mEnd, target);
+}
+
/*virtual*/
F32 LLOnHoverChangeableTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect)
{
@@ -3787,6 +3862,13 @@ LLInlineViewSegment::~LLInlineViewSegment()
mView->die();
}
+// virtual
+LLTextSegmentPtr LLInlineViewSegment::clone(LLTextBase& target) const
+{
+ llassert_always_msg(false, "NOT SUPPORTED");
+ return nullptr;
+}
+
bool LLInlineViewSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const
{
if (first_char == 0 && num_chars == 0)
@@ -3874,6 +3956,14 @@ LLLineBreakTextSegment::LLLineBreakTextSegment(LLStyleConstSP style,S32 pos):LLT
LLLineBreakTextSegment::~LLLineBreakTextSegment()
{
}
+
+// virtual
+LLTextSegmentPtr LLLineBreakTextSegment::clone(LLTextBase& target) const
+{
+ LLLineBreakTextSegment* copy = new LLLineBreakTextSegment(mStart);
+ copy->mFontHeight = mFontHeight;
+ return copy;
+}
bool LLLineBreakTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const
{
width = 0;
@@ -3901,8 +3991,16 @@ LLImageTextSegment::~LLImageTextSegment()
{
}
+// virtual
+LLTextSegmentPtr LLImageTextSegment::clone(LLTextBase& target) const
+{
+ LLStyleConstSP sp(cloneStyle(target, mStyle));
+ return new LLImageTextSegment(sp, mStart, target);
+}
+
static const S32 IMAGE_HPAD = 3;
+// virtual
bool LLImageTextSegment::getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const
{
width = 0;
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index eb4697da15..76d4e160af 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -45,6 +45,7 @@
class LLScrollContainer;
class LLContextMenu;
class LLUrlMatch;
+class LLTextBase;
///
/// A text segment is used to specify a subsection of a text string
@@ -62,6 +63,9 @@ public:
mEnd(end)
{}
virtual ~LLTextSegment();
+ virtual LLTextSegmentPtr clone(LLTextBase& terget) const { return new LLTextSegment(mStart, mEnd); }
+ static LLStyleSP cloneStyle(LLTextBase& target, const LLStyle* source);
+
bool getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const;
virtual bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const;
@@ -128,6 +132,7 @@ public:
LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor );
LLNormalTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true);
virtual ~LLNormalTextSegment();
+ /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const;
/*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const;
/*virtual*/ S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const;
@@ -180,6 +185,7 @@ class LLLabelTextSegment : public LLNormalTextSegment
public:
LLLabelTextSegment( LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor );
LLLabelTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true);
+ /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const;
protected:
@@ -194,6 +200,7 @@ class LLEmojiTextSegment : public LLNormalTextSegment
public:
LLEmojiTextSegment(LLStyleConstSP style, S32 start, S32 end, LLTextBase& editor);
LLEmojiTextSegment(const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible = true);
+ /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const override;
bool canEdit() const override { return false; }
bool handleToolTip(S32 x, S32 y, MASK mask) override;
@@ -204,6 +211,7 @@ class LLOnHoverChangeableTextSegment : public LLNormalTextSegment
{
public:
LLOnHoverChangeableTextSegment( LLStyleConstSP style, LLStyleConstSP normal_style, S32 start, S32 end, LLTextBase& editor );
+ /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const;
/*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect);
/*virtual*/ bool handleHover(S32 x, S32 y, MASK mask);
protected:
@@ -218,6 +226,7 @@ class LLIndexSegment : public LLTextSegment
{
public:
LLIndexSegment() : LLTextSegment(0, 0) {}
+ /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const { return new LLIndexSegment(); }
};
class LLInlineViewSegment : public LLTextSegment
@@ -235,6 +244,8 @@ public:
LLInlineViewSegment(const Params& p, S32 start, S32 end);
~LLInlineViewSegment();
+ /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const;
+
/*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const;
/*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const;
/*virtual*/ void updateLayout(const class LLTextBase& editor);
@@ -259,6 +270,7 @@ public:
LLLineBreakTextSegment(LLStyleConstSP style,S32 pos);
LLLineBreakTextSegment(S32 pos);
~LLLineBreakTextSegment();
+ /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const;
/*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const;
S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const;
F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect);
@@ -272,6 +284,8 @@ class LLImageTextSegment : public LLTextSegment
public:
LLImageTextSegment(LLStyleConstSP style,S32 pos,class LLTextBase& editor);
~LLImageTextSegment();
+ /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const;
+
/*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const;
S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 char_offset, S32 max_chars, S32 line_ind) const;
F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect);
@@ -510,6 +524,7 @@ public:
const LLFontGL* getFont() const override { return mFont; }
+ virtual void copyContents(const LLTextBase* source);
virtual void appendLineBreakSegment(const LLStyle::Params& style_params);
virtual void appendImageSegment(const LLStyle::Params& style_params);
virtual void appendWidget(const LLInlineViewSegment::Params& params, const std::string& text, bool allow_undo);
diff --git a/indra/llui/lltrans.cpp b/indra/llui/lltrans.cpp
index 8410031653..0c6c5b64e4 100644
--- a/indra/llui/lltrans.cpp
+++ b/indra/llui/lltrans.cpp
@@ -28,12 +28,8 @@
#include "lltrans.h"
-#include "llfasttimer.h" // for call count statistics
#include "llxuiparser.h"
#include "llsd.h"
-#include "llxmlnode.h"
-
-#include <map>
LLTrans::template_map_t LLTrans::sStringTemplates;
LLTrans::template_map_t LLTrans::sDefaultStringTemplates;
@@ -59,7 +55,7 @@ struct StringTable : public LLInitParam::Block<StringTable>
};
//static
-bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& default_args)
+bool LLTrans::parseStrings(LLXMLNodePtr& root, const std::set<std::string>& default_args)
{
std::string xml_filename = "(strings file)";
if (!root->hasName("strings"))
@@ -107,7 +103,7 @@ bool LLTrans::parseStrings(LLXMLNodePtr &root, const std::set<std::string>& defa
//static
-bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root)
+bool LLTrans::parseLanguageStrings(LLXMLNodePtr& root)
{
std::string xml_filename = "(language strings file)";
if (!root->hasName("strings"))
@@ -138,10 +134,6 @@ bool LLTrans::parseLanguageStrings(LLXMLNodePtr &root)
return true;
}
-
-
-static LLTrace::BlockTimerStatHandle FTM_GET_TRANS("Translate string");
-
//static
std::string LLTrans::getString(std::string_view xml_desc, const LLStringUtil::format_map_t& msg_args, bool def_string)
{
@@ -235,7 +227,7 @@ std::string LLTrans::getDefString(std::string_view xml_desc, const LLSD& msg_arg
}
//static
-bool LLTrans::findString(std::string &result, std::string_view xml_desc, const LLStringUtil::format_map_t& msg_args)
+bool LLTrans::findString(std::string& result, std::string_view xml_desc, const LLStringUtil::format_map_t& msg_args)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
@@ -257,7 +249,7 @@ bool LLTrans::findString(std::string &result, std::string_view xml_desc, const L
}
//static
-bool LLTrans::findString(std::string &result, std::string_view xml_desc, const LLSD& msg_args)
+bool LLTrans::findString(std::string& result, std::string_view xml_desc, const LLSD& msg_args)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
@@ -277,7 +269,7 @@ bool LLTrans::findString(std::string &result, std::string_view xml_desc, const L
}
//static
-std::string LLTrans::getCountString(const std::string& language, const std::string& xml_desc, S32 count)
+std::string LLTrans::getCountString(std::string_view language, std::string_view xml_desc, S32 count)
{
// Compute which string identifier to use
const char* form = "";
@@ -337,7 +329,7 @@ std::string LLTrans::getCountString(const std::string& language, const std::stri
args["[COUNT]"] = llformat("%d", count);
// Look up "AgeYearsB" or "AgeWeeksC" including the "form"
- std::string key = llformat("%s%s", xml_desc.c_str(), form);
+ std::string key = llformat("%s%s", xml_desc.data(), form);
return getString(key, args);
}
diff --git a/indra/llui/lltrans.h b/indra/llui/lltrans.h
index 3492ed0169..c5d01e6f8d 100644
--- a/indra/llui/lltrans.h
+++ b/indra/llui/lltrans.h
@@ -30,10 +30,8 @@
#include <map>
#include <set>
-#include "llpointer.h"
#include "llstring.h"
-
-class LLXMLNode;
+#include "llxmlnode.h"
class LLSD;
@@ -58,17 +56,17 @@ public:
class LLTrans
{
public:
- LLTrans();
+ LLTrans() = default;
/**
* @brief Parses the xml root that holds the strings. Used once on startup
-// *FIXME * @param xml_filename Filename to parse
+ * @param root xml root node to parse
* @param default_args Set of strings (expected to be in the file) to use as default replacement args, e.g. "SECOND_LIFE"
* @returns true if the file was parsed successfully, true if something went wrong
*/
- static bool parseStrings(LLPointer<LLXMLNode> & root, const std::set<std::string>& default_args);
+ static bool parseStrings(LLXMLNodePtr& root, const std::set<std::string>& default_args);
- static bool parseLanguageStrings(LLPointer<LLXMLNode> & root);
+ static bool parseLanguageStrings(LLXMLNodePtr& root);
/**
* @brief Returns a translated string
@@ -80,14 +78,14 @@ public:
static std::string getDefString(std::string_view xml_desc, const LLStringUtil::format_map_t& args);
static std::string getString(std::string_view xml_desc, const LLSD& args, bool def_string = false);
static std::string getDefString(std::string_view xml_desc, const LLSD& args);
- static bool findString(std::string &result, std::string_view xml_desc, const LLStringUtil::format_map_t& args);
- static bool findString(std::string &result, std::string_view xml_desc, const LLSD& args);
+ static bool findString(std::string& result, std::string_view xml_desc, const LLStringUtil::format_map_t& args);
+ static bool findString(std::string& result, std::string_view xml_desc, const LLSD& args);
// Returns translated string with [COUNT] replaced with a number, following
// special per-language logic for plural nouns. For example, some languages
// may have different plurals for 0, 1, 2 and > 2.
// See "AgeWeeksA", "AgeWeeksB", etc. in strings.xml for examples.
- static std::string getCountString(const std::string& language, const std::string& xml_desc, S32 count);
+ static std::string getCountString(std::string_view language, std::string_view xml_desc, S32 count);
/**
* @brief Returns a translated string
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index 7d6c937b85..0206e46b57 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -1370,8 +1370,10 @@ void LLView::drawDebugRect()
y = rect_height - LINE_HEIGHT * (depth % lines + 1);
- std::string debug_text = llformat("%s (%d x %d)", getName().c_str(),
- debug_rect.getWidth(), debug_rect.getHeight());
+ std::string debug_text = llformat("%s [%d, %d] + (%d x %d) = [%d, %d]", getName().c_str(),
+ debug_rect.mLeft, mParentView->getRect().getHeight() - debug_rect.mTop,
+ debug_rect.getWidth(), debug_rect.getHeight(),
+ debug_rect.mRight, mParentView->getRect().getHeight() - debug_rect.mBottom);
LLFontGL::getFontSansSerifSmall()->renderUTF8(debug_text, 0, (F32)x, (F32)y, border_color,
LLFontGL::HCENTER, LLFontGL::BASELINE, LLFontGL::NORMAL, LLFontGL::NO_SHADOW);
}
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt
index 2996f58fe0..075e17235a 100644
--- a/indra/llwindow/CMakeLists.txt
+++ b/indra/llwindow/CMakeLists.txt
@@ -59,12 +59,14 @@ set(llwindow_LINK_LIBRARIES
ll::glext
ll::uilibraries
ll::SDL
+ ll::zlib-ng
)
+
# Libraries on which this library depends, needed for Linux builds
# Sort by high-level to low-level
if (LINUX)
- list(APPEND viewer_SOURCE_FILES
- llkeyboardsdl.cpp
+ list(APPEND viewer_SOURCE_FILES
+ llkeyboardsdl.cpp
llwindowsdl.cpp
)
list(APPEND viewer_HEADER_FILES
@@ -84,7 +86,6 @@ if (LINUX)
fontconfig # For FCInit and other FC* functions.
)
endif (BUILD_HEADLESS)
-
endif (LINUX)
if (DARWIN)
@@ -180,7 +181,7 @@ endif (SDL_FOUND)
target_link_libraries (llwindow ${llwindow_LINK_LIBRARIES})
target_include_directories(llwindow INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
-
+
if (DARWIN)
include(CMakeFindFrameworks)
find_library(CARBON_LIBRARY Carbon)
diff --git a/indra/llwindow/lldragdropwin32.h b/indra/llwindow/lldragdropwin32.h
index 1b30dced27..16d016677b 100644
--- a/indra/llwindow/lldragdropwin32.h
+++ b/indra/llwindow/lldragdropwin32.h
@@ -31,7 +31,7 @@
#ifndef LL_LLDRAGDROP32_H
#define LL_LLDRAGDROP32_H
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include <ole2.h>
class LLDragDropWin32
@@ -54,7 +54,7 @@ class LLDragDropWin32
#ifndef LL_LLDRAGDROP32_H
#define LL_LLDRAGDROP32_H
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include <ole2.h>
// impostor class that does nothing
diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp
index 33eebdadd1..a16c0a318a 100644
--- a/indra/llwindow/llkeyboard.cpp
+++ b/indra/llwindow/llkeyboard.cpp
@@ -41,7 +41,6 @@ std::map<KEY,std::string> LLKeyboard::sKeysToNames;
std::map<std::string,KEY> LLKeyboard::sNamesToKeys;
LLKeyStringTranslatorFunc* LLKeyboard::mStringTranslator = NULL; // Used for l10n + PC/Mac/Linux accelerator labeling
-
//
// Class Implementation
//
@@ -195,12 +194,11 @@ void LLKeyboard::resetKeys()
}
-bool LLKeyboard::translateKey(const U16 os_key, KEY *out_key)
+bool LLKeyboard::translateKey(const NATIVE_KEY_TYPE os_key, KEY *out_key)
{
- std::map<U16, KEY>::iterator iter;
// Only translate keys in the map, ignore all other keys for now
- iter = mTranslateKeyMap.find(os_key);
+ auto iter = mTranslateKeyMap.find(os_key);
if (iter == mTranslateKeyMap.end())
{
//LL_WARNS() << "Unknown virtual key " << os_key << LL_ENDL;
@@ -214,11 +212,9 @@ bool LLKeyboard::translateKey(const U16 os_key, KEY *out_key)
}
}
-
-U16 LLKeyboard::inverseTranslateKey(const KEY translated_key)
+LLKeyboard::NATIVE_KEY_TYPE LLKeyboard::inverseTranslateKey(const KEY translated_key)
{
- std::map<KEY, U16>::iterator iter;
- iter = mInvTranslateKeyMap.find(translated_key);
+ auto iter = mInvTranslateKeyMap.find(translated_key);
if (iter == mInvTranslateKeyMap.end())
{
return 0;
diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h
index 713eb7aec2..d3c35b1ed4 100644
--- a/indra/llwindow/llkeyboard.h
+++ b/indra/llwindow/llkeyboard.h
@@ -55,6 +55,11 @@ class LLWindowCallbacks;
class LLKeyboard
{
public:
+#ifndef LL_SDL
+ typedef U16 NATIVE_KEY_TYPE;
+#else
+ typedef U32 NATIVE_KEY_TYPE;
+#endif
LLKeyboard();
virtual ~LLKeyboard();
@@ -67,14 +72,13 @@ public:
bool getKeyDown(const KEY key) { return mKeyLevel[key]; }
bool getKeyRepeated(const KEY key) { return mKeyRepeated[key]; }
- bool translateKey(const U16 os_key, KEY *translated_key);
- U16 inverseTranslateKey(const KEY translated_key);
+ bool translateKey(const NATIVE_KEY_TYPE os_key, KEY *translated_key);
+ NATIVE_KEY_TYPE inverseTranslateKey(const KEY translated_key);
bool handleTranslatedKeyUp(KEY translated_key, U32 translated_mask); // Translated into "Linden" keycodes
bool handleTranslatedKeyDown(KEY translated_key, U32 translated_mask); // Translated into "Linden" keycodes
-
- virtual bool handleKeyUp(const U16 key, MASK mask) = 0;
- virtual bool handleKeyDown(const U16 key, MASK mask) = 0;
+ virtual bool handleKeyUp(const NATIVE_KEY_TYPE key, MASK mask) = 0;
+ virtual bool handleKeyDown(const NATIVE_KEY_TYPE key, MASK mask) = 0;
#ifdef LL_DARWIN
// We only actually use this for macOS.
@@ -111,8 +115,8 @@ protected:
void addKeyName(KEY key, const std::string& name);
protected:
- std::map<U16, KEY> mTranslateKeyMap; // Map of translations from OS keys to Linden KEYs
- std::map<KEY, U16> mInvTranslateKeyMap; // Map of translations from Linden KEYs to OS keys
+ std::map<NATIVE_KEY_TYPE, KEY> mTranslateKeyMap; // Map of translations from OS keys to Linden KEYs
+ std::map<KEY, NATIVE_KEY_TYPE> mInvTranslateKeyMap; // Map of translations from Linden KEYs to OS keys
LLWindowCallbacks *mCallbacks;
LLTimer mKeyLevelTimer[KEY_COUNT]; // Time since level was set
diff --git a/indra/llwindow/llkeyboardheadless.cpp b/indra/llwindow/llkeyboardheadless.cpp
index 8669a5b41a..ad8e42a412 100644
--- a/indra/llwindow/llkeyboardheadless.cpp
+++ b/indra/llwindow/llkeyboardheadless.cpp
@@ -34,14 +34,6 @@ LLKeyboardHeadless::LLKeyboardHeadless()
void LLKeyboardHeadless::resetMaskKeys()
{ }
-
-bool LLKeyboardHeadless::handleKeyDown(const U16 key, const U32 mask)
-{ return false; }
-
-
-bool LLKeyboardHeadless::handleKeyUp(const U16 key, const U32 mask)
-{ return false; }
-
MASK LLKeyboardHeadless::currentMask(bool for_mouse_event)
{ return MASK_NONE; }
diff --git a/indra/llwindow/llkeyboardheadless.h b/indra/llwindow/llkeyboardheadless.h
index 2528f0e3f1..439abaf25b 100644
--- a/indra/llwindow/llkeyboardheadless.h
+++ b/indra/llwindow/llkeyboardheadless.h
@@ -35,8 +35,13 @@ public:
LLKeyboardHeadless();
/*virtual*/ ~LLKeyboardHeadless() {};
- /*virtual*/ bool handleKeyUp(const U16 key, MASK mask);
- /*virtual*/ bool handleKeyDown(const U16 key, MASK mask);
+#ifndef LL_SDL
+ /*virtual*/ bool handleKeyUp(const U16 key, MASK mask) { return false; }
+ /*virtual*/ bool handleKeyDown(const U16 key, MASK mask) { return false; }
+#else
+ /*virtual*/ bool handleKeyUp(const U32 key, MASK mask) { return false; }
+ /*virtual*/ bool handleKeyDown(const U32 key, MASK mask) { return false; }
+#endif
/*virtual*/ void resetMaskKeys();
/*virtual*/ MASK currentMask(bool for_mouse_event);
/*virtual*/ void scanKeyboard();
diff --git a/indra/llwindow/llkeyboardsdl.cpp b/indra/llwindow/llkeyboardsdl.cpp
index 97198f0cc0..543882fc8f 100644
--- a/indra/llwindow/llkeyboardsdl.cpp
+++ b/indra/llwindow/llkeyboardsdl.cpp
@@ -1,6 +1,5 @@
/**
- * @file llkeyboardsdl.cpp
- * @brief Handler for assignable key bindings
+ * @author This module has many fathers, and it shows.
*
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
@@ -24,12 +23,11 @@
* $/LicenseInfo$
*/
-#if LL_SDL
-
#include "linden_common.h"
#include "llkeyboardsdl.h"
#include "llwindowcallbacks.h"
-#include "SDL/SDL.h"
+#include "SDL2/SDL.h"
+#include "SDL2/SDL_keycode.h"
LLKeyboardSDL::LLKeyboardSDL()
{
@@ -40,6 +38,10 @@ LLKeyboardSDL::LLKeyboardSDL()
// Virtual key mappings from SDL_keysym.h ...
// SDL maps the letter keys to the ASCII you'd expect, but it's lowercase...
+
+ // <FS:ND> Looks like we need to map those despite of SDL_TEXTINPUT handling most of this, but without
+ // the translation lower->upper here accelerators will not work.
+
U16 cur_char;
for (cur_char = 'A'; cur_char <= 'Z'; cur_char++)
{
@@ -68,13 +70,12 @@ LLKeyboardSDL::LLKeyboardSDL()
//mTranslateKeyMap[SDLK_KP3] = KEY_PAGE_DOWN;
//mTranslateKeyMap[SDLK_KP0] = KEY_INSERT;
- mTranslateKeyMap[SDLK_SPACE] = ' ';
+ mTranslateKeyMap[SDLK_SPACE] = ' '; // <FS:ND/> Those are handled by SDL2 via text input, do not map them
mTranslateKeyMap[SDLK_RETURN] = KEY_RETURN;
mTranslateKeyMap[SDLK_LEFT] = KEY_LEFT;
mTranslateKeyMap[SDLK_RIGHT] = KEY_RIGHT;
mTranslateKeyMap[SDLK_UP] = KEY_UP;
mTranslateKeyMap[SDLK_DOWN] = KEY_DOWN;
- mTranslateKeyMap[SDLK_ESCAPE] = KEY_ESCAPE;
mTranslateKeyMap[SDLK_KP_ENTER] = KEY_RETURN;
mTranslateKeyMap[SDLK_ESCAPE] = KEY_ESCAPE;
mTranslateKeyMap[SDLK_BACKSPACE] = KEY_BACKSPACE;
@@ -111,40 +112,39 @@ LLKeyboardSDL::LLKeyboardSDL()
mTranslateKeyMap[SDLK_F10] = KEY_F10;
mTranslateKeyMap[SDLK_F11] = KEY_F11;
mTranslateKeyMap[SDLK_F12] = KEY_F12;
- mTranslateKeyMap[SDLK_PLUS] = '=';
- mTranslateKeyMap[SDLK_COMMA] = ',';
- mTranslateKeyMap[SDLK_MINUS] = '-';
- mTranslateKeyMap[SDLK_PERIOD] = '.';
- mTranslateKeyMap[SDLK_BACKQUOTE] = '`';
- mTranslateKeyMap[SDLK_SLASH] = KEY_DIVIDE;
- mTranslateKeyMap[SDLK_SEMICOLON] = ';';
- mTranslateKeyMap[SDLK_LEFTBRACKET] = '[';
- mTranslateKeyMap[SDLK_BACKSLASH] = '\\';
- mTranslateKeyMap[SDLK_RIGHTBRACKET] = ']';
- mTranslateKeyMap[SDLK_QUOTE] = '\'';
+ mTranslateKeyMap[SDLK_PLUS] = '='; // <FS:ND/> Those are handled by SDL2 via text input, do not map them
+ mTranslateKeyMap[SDLK_COMMA] = ','; // <FS:ND/> Those are handled by SDL2 via text input, do not map them
+ mTranslateKeyMap[SDLK_MINUS] = '-'; // <FS:ND/> Those are handled by SDL2 via text input, do not map them
+ mTranslateKeyMap[SDLK_PERIOD] = '.'; // <FS:ND/> Those are handled by SDL2 via text input, do not map them
+ mTranslateKeyMap[SDLK_BACKQUOTE] = '`'; // <FS:ND/> Those are handled by SDL2 via text input, do not map them
+ mTranslateKeyMap[SDLK_SLASH] = KEY_DIVIDE; // <FS:ND/> Those are handled by SDL2 via text input, do not map them
+ mTranslateKeyMap[SDLK_SEMICOLON] = ';'; // <FS:ND/> Those are handled by SDL2 via text input, do not map them
+ mTranslateKeyMap[SDLK_LEFTBRACKET] = '['; // <FS:ND/> Those are handled by SDL2 via text input, do not map them
+ mTranslateKeyMap[SDLK_BACKSLASH] = '\\'; // <FS:ND/> Those are handled by SDL2 via text input, do not map them
+ mTranslateKeyMap[SDLK_RIGHTBRACKET] = ']'; // <FS:ND/> Those are handled by SDL2 via text input, do not map them
+ mTranslateKeyMap[SDLK_QUOTE] = '\''; // <FS:ND/> Those are handled by SDL2 via text input, do not map them
// Build inverse map
- std::map<U16, KEY>::iterator iter;
- for (iter = mTranslateKeyMap.begin(); iter != mTranslateKeyMap.end(); iter++)
+ for (auto iter = mTranslateKeyMap.begin(); iter != mTranslateKeyMap.end(); iter++)
{
mInvTranslateKeyMap[iter->second] = iter->first;
}
// numpad map
- mTranslateNumpadMap[SDLK_KP0] = KEY_PAD_INS;
- mTranslateNumpadMap[SDLK_KP1] = KEY_PAD_END;
- mTranslateNumpadMap[SDLK_KP2] = KEY_PAD_DOWN;
- mTranslateNumpadMap[SDLK_KP3] = KEY_PAD_PGDN;
- mTranslateNumpadMap[SDLK_KP4] = KEY_PAD_LEFT;
- mTranslateNumpadMap[SDLK_KP5] = KEY_PAD_CENTER;
- mTranslateNumpadMap[SDLK_KP6] = KEY_PAD_RIGHT;
- mTranslateNumpadMap[SDLK_KP7] = KEY_PAD_HOME;
- mTranslateNumpadMap[SDLK_KP8] = KEY_PAD_UP;
- mTranslateNumpadMap[SDLK_KP9] = KEY_PAD_PGUP;
+ mTranslateNumpadMap[SDLK_KP_0] = KEY_PAD_INS;
+ mTranslateNumpadMap[SDLK_KP_1] = KEY_PAD_END;
+ mTranslateNumpadMap[SDLK_KP_2] = KEY_PAD_DOWN;
+ mTranslateNumpadMap[SDLK_KP_3] = KEY_PAD_PGDN;
+ mTranslateNumpadMap[SDLK_KP_4] = KEY_PAD_LEFT;
+ mTranslateNumpadMap[SDLK_KP_5] = KEY_PAD_CENTER;
+ mTranslateNumpadMap[SDLK_KP_6] = KEY_PAD_RIGHT;
+ mTranslateNumpadMap[SDLK_KP_7] = KEY_PAD_HOME;
+ mTranslateNumpadMap[SDLK_KP_8] = KEY_PAD_UP;
+ mTranslateNumpadMap[SDLK_KP_9] = KEY_PAD_PGUP;
mTranslateNumpadMap[SDLK_KP_PERIOD] = KEY_PAD_DEL;
// build inverse numpad map
- for (iter = mTranslateNumpadMap.begin();
+ for (auto iter = mTranslateNumpadMap.begin();
iter != mTranslateNumpadMap.end();
iter++)
{
@@ -154,7 +154,7 @@ LLKeyboardSDL::LLKeyboardSDL()
void LLKeyboardSDL::resetMaskKeys()
{
- SDLMod mask = SDL_GetModState();
+ SDL_Keymod mask = SDL_GetModState();
// MBW -- XXX -- This mirrors the operation of the Windows version of resetMaskKeys().
// It looks a bit suspicious, as it won't correct for keys that have been released.
@@ -201,37 +201,37 @@ MASK LLKeyboardSDL::updateModifiers(const U32 mask)
}
-static U16 adjustNativekeyFromUnhandledMask(const U16 key, const U32 mask)
+static U32 adjustNativekeyFromUnhandledMask(const U32 key, const U32 mask)
{
// SDL doesn't automatically adjust the keysym according to
// whether NUMLOCK is engaged, so we massage the keysym manually.
- U16 rtn = key;
+ U32 rtn = key;
if (!(mask & KMOD_NUM))
{
switch (key)
{
- case SDLK_KP_PERIOD: rtn = SDLK_DELETE; break;
- case SDLK_KP0: rtn = SDLK_INSERT; break;
- case SDLK_KP1: rtn = SDLK_END; break;
- case SDLK_KP2: rtn = SDLK_DOWN; break;
- case SDLK_KP3: rtn = SDLK_PAGEDOWN; break;
- case SDLK_KP4: rtn = SDLK_LEFT; break;
- case SDLK_KP6: rtn = SDLK_RIGHT; break;
- case SDLK_KP7: rtn = SDLK_HOME; break;
- case SDLK_KP8: rtn = SDLK_UP; break;
- case SDLK_KP9: rtn = SDLK_PAGEUP; break;
+ case SDLK_KP_PERIOD: rtn = SDLK_DELETE; break;
+ case SDLK_KP_0: rtn = SDLK_INSERT; break;
+ case SDLK_KP_1: rtn = SDLK_END; break;
+ case SDLK_KP_2: rtn = SDLK_DOWN; break;
+ case SDLK_KP_3: rtn = SDLK_PAGEDOWN; break;
+ case SDLK_KP_4: rtn = SDLK_LEFT; break;
+ case SDLK_KP_6: rtn = SDLK_RIGHT; break;
+ case SDLK_KP_7: rtn = SDLK_HOME; break;
+ case SDLK_KP_8: rtn = SDLK_UP; break;
+ case SDLK_KP_9: rtn = SDLK_PAGEUP; break;
}
}
return rtn;
}
-bool LLKeyboardSDL::handleKeyDown(const U16 key, const U32 mask)
+bool LLKeyboardSDL::handleKeyDown(const U32 key, const U32 mask)
{
- U16 adjusted_nativekey;
+ U32 adjusted_nativekey;
KEY translated_key = 0;
U32 translated_mask = MASK_NONE;
- bool handled = false;
+ bool handled = false;
adjusted_nativekey = adjustNativekeyFromUnhandledMask(key, mask);
@@ -246,12 +246,12 @@ bool LLKeyboardSDL::handleKeyDown(const U16 key, const U32 mask)
}
-bool LLKeyboardSDL::handleKeyUp(const U16 key, const U32 mask)
+bool LLKeyboardSDL::handleKeyUp(const U32 key, const U32 mask)
{
- U16 adjusted_nativekey;
+ U32 adjusted_nativekey;
KEY translated_key = 0;
U32 translated_mask = MASK_NONE;
- bool handled = false;
+ bool handled = false;
adjusted_nativekey = adjustNativekeyFromUnhandledMask(key, mask);
@@ -268,16 +268,20 @@ bool LLKeyboardSDL::handleKeyUp(const U16 key, const U32 mask)
MASK LLKeyboardSDL::currentMask(bool for_mouse_event)
{
MASK result = MASK_NONE;
- SDLMod mask = SDL_GetModState();
+ SDL_Keymod mask = SDL_GetModState();
- if (mask & KMOD_SHIFT) result |= MASK_SHIFT;
- if (mask & KMOD_CTRL) result |= MASK_CONTROL;
- if (mask & KMOD_ALT) result |= MASK_ALT;
+ if (mask & KMOD_SHIFT)
+ result |= MASK_SHIFT;
+ if (mask & KMOD_CTRL)
+ result |= MASK_CONTROL;
+ if (mask & KMOD_ALT)
+ result |= MASK_ALT;
// For keyboard events, consider Meta keys equivalent to Control
if (!for_mouse_event)
{
- if (mask & KMOD_META) result |= MASK_CONTROL;
+ if (mask & KMOD_GUI)
+ result |= MASK_CONTROL;
}
return result;
@@ -310,7 +314,7 @@ void LLKeyboardSDL::scanKeyboard()
}
-bool LLKeyboardSDL::translateNumpadKey( const U16 os_key, KEY *translated_key)
+bool LLKeyboardSDL::translateNumpadKey( const U32 os_key, KEY *translated_key)
{
return translateKey(os_key, translated_key);
}
@@ -320,5 +324,338 @@ U16 LLKeyboardSDL::inverseTranslateNumpadKey(const KEY translated_key)
return inverseTranslateKey(translated_key);
}
-#endif
+enum class WindowsVK : U32
+{
+ VK_UNKNOWN = 0,
+ VK_CANCEL = 0x03,
+ VK_BACK = 0x08,
+ VK_TAB = 0x09,
+ VK_CLEAR = 0x0C,
+ VK_RETURN = 0x0D,
+ VK_SHIFT = 0x10,
+ VK_CONTROL = 0x11,
+ VK_MENU = 0x12,
+ VK_PAUSE = 0x13,
+ VK_CAPITAL = 0x14,
+ VK_KANA = 0x15,
+ VK_HANGUL = 0x15,
+ VK_JUNJA = 0x17,
+ VK_FINAL = 0x18,
+ VK_HANJA = 0x19,
+ VK_KANJI = 0x19,
+ VK_ESCAPE = 0x1B,
+ VK_CONVERT = 0x1C,
+ VK_NONCONVERT = 0x1D,
+ VK_ACCEPT = 0x1E,
+ VK_MODECHANGE = 0x1F,
+ VK_SPACE = 0x20,
+ VK_PRIOR = 0x21,
+ VK_NEXT = 0x22,
+ VK_END = 0x23,
+ VK_HOME = 0x24,
+ VK_LEFT = 0x25,
+ VK_UP = 0x26,
+ VK_RIGHT = 0x27,
+ VK_DOWN = 0x28,
+ VK_SELECT = 0x29,
+ VK_PRINT = 0x2A,
+ VK_EXECUTE = 0x2B,
+ VK_SNAPSHOT = 0x2C,
+ VK_INSERT = 0x2D,
+ VK_DELETE = 0x2E,
+ VK_HELP = 0x2F,
+ VK_0 = 0x30,
+ VK_1 = 0x31,
+ VK_2 = 0x32,
+ VK_3 = 0x33,
+ VK_4 = 0x34,
+ VK_5 = 0x35,
+ VK_6 = 0x36,
+ VK_7 = 0x37,
+ VK_8 = 0x38,
+ VK_9 = 0x39,
+ VK_A = 0x41,
+ VK_B = 0x42,
+ VK_C = 0x43,
+ VK_D = 0x44,
+ VK_E = 0x45,
+ VK_F = 0x46,
+ VK_G = 0x47,
+ VK_H = 0x48,
+ VK_I = 0x49,
+ VK_J = 0x4A,
+ VK_K = 0x4B,
+ VK_L = 0x4C,
+ VK_M = 0x4D,
+ VK_N = 0x4E,
+ VK_O = 0x4F,
+ VK_P = 0x50,
+ VK_Q = 0x51,
+ VK_R = 0x52,
+ VK_S = 0x53,
+ VK_T = 0x54,
+ VK_U = 0x55,
+ VK_V = 0x56,
+ VK_W = 0x57,
+ VK_X = 0x58,
+ VK_Y = 0x59,
+ VK_Z = 0x5A,
+ VK_LWIN = 0x5B,
+ VK_RWIN = 0x5C,
+ VK_APPS = 0x5D,
+ VK_SLEEP = 0x5F,
+ VK_NUMPAD0 = 0x60,
+ VK_NUMPAD1 = 0x61,
+ VK_NUMPAD2 = 0x62,
+ VK_NUMPAD3 = 0x63,
+ VK_NUMPAD4 = 0x64,
+ VK_NUMPAD5 = 0x65,
+ VK_NUMPAD6 = 0x66,
+ VK_NUMPAD7 = 0x67,
+ VK_NUMPAD8 = 0x68,
+ VK_NUMPAD9 = 0x69,
+ VK_MULTIPLY = 0x6A,
+ VK_ADD = 0x6B,
+ VK_SEPARATOR = 0x6C,
+ VK_SUBTRACT = 0x6D,
+ VK_DECIMAL = 0x6E,
+ VK_DIVIDE = 0x6F,
+ VK_F1 = 0x70,
+ VK_F2 = 0x71,
+ VK_F3 = 0x72,
+ VK_F4 = 0x73,
+ VK_F5 = 0x74,
+ VK_F6 = 0x75,
+ VK_F7 = 0x76,
+ VK_F8 = 0x77,
+ VK_F9 = 0x78,
+ VK_F10 = 0x79,
+ VK_F11 = 0x7A,
+ VK_F12 = 0x7B,
+ VK_F13 = 0x7C,
+ VK_F14 = 0x7D,
+ VK_F15 = 0x7E,
+ VK_F16 = 0x7F,
+ VK_F17 = 0x80,
+ VK_F18 = 0x81,
+ VK_F19 = 0x82,
+ VK_F20 = 0x83,
+ VK_F21 = 0x84,
+ VK_F22 = 0x85,
+ VK_F23 = 0x86,
+ VK_F24 = 0x87,
+ VK_NUMLOCK = 0x90,
+ VK_SCROLL = 0x91,
+ VK_LSHIFT = 0xA0,
+ VK_RSHIFT = 0xA1,
+ VK_LCONTROL = 0xA2,
+ VK_RCONTROL = 0xA3,
+ VK_LMENU = 0xA4,
+ VK_RMENU = 0xA5,
+ VK_BROWSER_BACK = 0xA6,
+ VK_BROWSER_FORWARD = 0xA7,
+ VK_BROWSER_REFRESH = 0xA8,
+ VK_BROWSER_STOP = 0xA9,
+ VK_BROWSER_SEARCH = 0xAA,
+ VK_BROWSER_FAVORITES = 0xAB,
+ VK_BROWSER_HOME = 0xAC,
+ VK_VOLUME_MUTE = 0xAD,
+ VK_VOLUME_DOWN = 0xAE,
+ VK_VOLUME_UP = 0xAF,
+ VK_MEDIA_NEXT_TRACK = 0xB0,
+ VK_MEDIA_PREV_TRACK = 0xB1,
+ VK_MEDIA_STOP = 0xB2,
+ VK_MEDIA_PLAY_PAUSE = 0xB3,
+ VK_MEDIA_LAUNCH_MAIL = 0xB4,
+ VK_MEDIA_LAUNCH_MEDIA_SELECT = 0xB5,
+ VK_MEDIA_LAUNCH_APP1 = 0xB6,
+ VK_MEDIA_LAUNCH_APP2 = 0xB7,
+ VK_OEM_1 = 0xBA,
+ VK_OEM_PLUS = 0xBB,
+ VK_OEM_COMMA = 0xBC,
+ VK_OEM_MINUS = 0xBD,
+ VK_OEM_PERIOD = 0xBE,
+ VK_OEM_2 = 0xBF,
+ VK_OEM_3 = 0xC0,
+ VK_OEM_4 = 0xDB,
+ VK_OEM_5 = 0xDC,
+ VK_OEM_6 = 0xDD,
+ VK_OEM_7 = 0xDE,
+ VK_OEM_8 = 0xDF,
+ VK_OEM_102 = 0xE2,
+ VK_PROCESSKEY = 0xE5,
+ VK_PACKET = 0xE7,
+ VK_ATTN = 0xF6,
+ VK_CRSEL = 0xF7,
+ VK_EXSEL = 0xF8,
+ VK_EREOF = 0xF9,
+ VK_PLAY = 0xFA,
+ VK_ZOOM = 0xFB,
+ VK_NONAME = 0xFC,
+ VK_PA1 = 0xFD,
+ VK_OEM_CLEAR = 0xFE,
+};
+
+std::map< U32, U32 > mSDL2_to_Win;
+std::set< U32 > mIgnoreSDL2Keys;
+
+U32 LLKeyboardSDL::mapSDL2toWin( U32 aSymbol )
+{
+ // <FS:ND> Map SDLK_ virtual keys to Windows VK_ virtual keys.
+ // Text is handled via unicode input (SDL_TEXTINPUT event) and does not need to be translated into VK_ values as those match already.
+ if( mSDL2_to_Win.empty() )
+ {
+
+ mSDL2_to_Win[ SDLK_BACKSPACE ] = (U32)WindowsVK::VK_BACK;
+ mSDL2_to_Win[ SDLK_TAB ] = (U32)WindowsVK::VK_TAB;
+ mSDL2_to_Win[ 12 ] = (U32)WindowsVK::VK_CLEAR;
+ mSDL2_to_Win[ SDLK_RETURN ] = (U32)WindowsVK::VK_RETURN;
+ mSDL2_to_Win[ 19 ] = (U32)WindowsVK::VK_PAUSE;
+ mSDL2_to_Win[ SDLK_ESCAPE ] = (U32)WindowsVK::VK_ESCAPE;
+ mSDL2_to_Win[ SDLK_SPACE ] = (U32)WindowsVK::VK_SPACE;
+ mSDL2_to_Win[ SDLK_QUOTE ] = (U32)WindowsVK::VK_OEM_7;
+ mSDL2_to_Win[ SDLK_COMMA ] = (U32)WindowsVK::VK_OEM_COMMA;
+ mSDL2_to_Win[ SDLK_MINUS ] = (U32)WindowsVK::VK_OEM_MINUS;
+ mSDL2_to_Win[ SDLK_PERIOD ] = (U32)WindowsVK::VK_OEM_PERIOD;
+ mSDL2_to_Win[ SDLK_SLASH ] = (U32)WindowsVK::VK_OEM_2;
+
+ mSDL2_to_Win[ SDLK_0 ] = (U32)WindowsVK::VK_0;
+ mSDL2_to_Win[ SDLK_1 ] = (U32)WindowsVK::VK_1;
+ mSDL2_to_Win[ SDLK_2 ] = (U32)WindowsVK::VK_2;
+ mSDL2_to_Win[ SDLK_3 ] = (U32)WindowsVK::VK_3;
+ mSDL2_to_Win[ SDLK_4 ] = (U32)WindowsVK::VK_4;
+ mSDL2_to_Win[ SDLK_5 ] = (U32)WindowsVK::VK_5;
+ mSDL2_to_Win[ SDLK_6 ] = (U32)WindowsVK::VK_6;
+ mSDL2_to_Win[ SDLK_7 ] = (U32)WindowsVK::VK_7;
+ mSDL2_to_Win[ SDLK_8 ] = (U32)WindowsVK::VK_8;
+ mSDL2_to_Win[ SDLK_9 ] = (U32)WindowsVK::VK_9;
+
+ mSDL2_to_Win[ SDLK_SEMICOLON ] = (U32)WindowsVK::VK_OEM_1;
+ mSDL2_to_Win[ SDLK_LESS ] = (U32)WindowsVK::VK_OEM_102;
+ mSDL2_to_Win[ SDLK_EQUALS ] = (U32)WindowsVK::VK_OEM_PLUS;
+ mSDL2_to_Win[ SDLK_KP_EQUALS ] = (U32)WindowsVK::VK_OEM_PLUS;
+
+ mSDL2_to_Win[ SDLK_LEFTBRACKET ] = (U32)WindowsVK::VK_OEM_4;
+ mSDL2_to_Win[ SDLK_BACKSLASH ] = (U32)WindowsVK::VK_OEM_5;
+ mSDL2_to_Win[ SDLK_RIGHTBRACKET ] = (U32)WindowsVK::VK_OEM_6;
+ mSDL2_to_Win[ SDLK_BACKQUOTE ] = (U32)WindowsVK::VK_OEM_8;
+
+ mSDL2_to_Win[ SDLK_a ] = (U32)WindowsVK::VK_A;
+ mSDL2_to_Win[ SDLK_b ] = (U32)WindowsVK::VK_B;
+ mSDL2_to_Win[ SDLK_c ] = (U32)WindowsVK::VK_C;
+ mSDL2_to_Win[ SDLK_d ] = (U32)WindowsVK::VK_D;
+ mSDL2_to_Win[ SDLK_e ] = (U32)WindowsVK::VK_E;
+ mSDL2_to_Win[ SDLK_f ] = (U32)WindowsVK::VK_F;
+ mSDL2_to_Win[ SDLK_g ] = (U32)WindowsVK::VK_G;
+ mSDL2_to_Win[ SDLK_h ] = (U32)WindowsVK::VK_H;
+ mSDL2_to_Win[ SDLK_i ] = (U32)WindowsVK::VK_I;
+ mSDL2_to_Win[ SDLK_j ] = (U32)WindowsVK::VK_J;
+ mSDL2_to_Win[ SDLK_k ] = (U32)WindowsVK::VK_K;
+ mSDL2_to_Win[ SDLK_l ] = (U32)WindowsVK::VK_L;
+ mSDL2_to_Win[ SDLK_m ] = (U32)WindowsVK::VK_M;
+ mSDL2_to_Win[ SDLK_n ] = (U32)WindowsVK::VK_N;
+ mSDL2_to_Win[ SDLK_o ] = (U32)WindowsVK::VK_O;
+ mSDL2_to_Win[ SDLK_p ] = (U32)WindowsVK::VK_P;
+ mSDL2_to_Win[ SDLK_q ] = (U32)WindowsVK::VK_Q;
+ mSDL2_to_Win[ SDLK_r ] = (U32)WindowsVK::VK_R;
+ mSDL2_to_Win[ SDLK_s ] = (U32)WindowsVK::VK_S;
+ mSDL2_to_Win[ SDLK_t ] = (U32)WindowsVK::VK_T;
+ mSDL2_to_Win[ SDLK_u ] = (U32)WindowsVK::VK_U;
+ mSDL2_to_Win[ SDLK_v ] = (U32)WindowsVK::VK_V;
+ mSDL2_to_Win[ SDLK_w ] = (U32)WindowsVK::VK_W;
+ mSDL2_to_Win[ SDLK_x ] = (U32)WindowsVK::VK_X;
+ mSDL2_to_Win[ SDLK_y ] = (U32)WindowsVK::VK_Y;
+ mSDL2_to_Win[ SDLK_z ] = (U32)WindowsVK::VK_Z;
+
+ mSDL2_to_Win[ SDLK_DELETE ] = (U32)WindowsVK::VK_DELETE;
+
+
+ mSDL2_to_Win[ SDLK_NUMLOCKCLEAR ] = (U32)WindowsVK::VK_NUMLOCK;
+ mSDL2_to_Win[ SDLK_SCROLLLOCK ] = (U32)WindowsVK::VK_SCROLL;
+
+ mSDL2_to_Win[ SDLK_HELP ] = (U32)WindowsVK::VK_HELP;
+ mSDL2_to_Win[ SDLK_PRINTSCREEN ] = (U32)WindowsVK::VK_SNAPSHOT;
+ mSDL2_to_Win[ SDLK_CANCEL ] = (U32)WindowsVK::VK_CANCEL;
+ mSDL2_to_Win[ SDLK_APPLICATION ] = (U32)WindowsVK::VK_APPS;
+
+ mSDL2_to_Win[ SDLK_UNKNOWN ] = (U32)WindowsVK::VK_UNKNOWN;
+ mSDL2_to_Win[ SDLK_BACKSPACE ] = (U32)WindowsVK::VK_BACK;
+ mSDL2_to_Win[ SDLK_TAB ] = (U32)WindowsVK::VK_TAB;
+ mSDL2_to_Win[ SDLK_CLEAR ] = (U32)WindowsVK::VK_CLEAR;
+ mSDL2_to_Win[ SDLK_RETURN ] = (U32)WindowsVK::VK_RETURN;
+ mSDL2_to_Win[ SDLK_PAUSE ] = (U32)WindowsVK::VK_PAUSE;
+ mSDL2_to_Win[ SDLK_ESCAPE ] = (U32)WindowsVK::VK_ESCAPE;
+ mSDL2_to_Win[ SDLK_DELETE ] = (U32)WindowsVK::VK_DELETE;
+
+ mSDL2_to_Win[ SDLK_KP_PERIOD ] = (U32)WindowsVK::VK_OEM_PERIOD; // VK_DECIMAL?
+ mSDL2_to_Win[ SDLK_KP_DIVIDE ] = (U32)WindowsVK::VK_DIVIDE;
+ mSDL2_to_Win[ SDLK_KP_MULTIPLY] = (U32)WindowsVK::VK_MULTIPLY;
+ mSDL2_to_Win[ SDLK_KP_MINUS ] = (U32)WindowsVK::VK_OEM_MINUS; // VK_SUBSTRACT?
+ mSDL2_to_Win[ SDLK_KP_PLUS ] = (U32)WindowsVK::VK_OEM_PLUS; // VK_ADD?
+ mSDL2_to_Win[ SDLK_KP_ENTER ] = (U32)WindowsVK::VK_RETURN;
+ mSDL2_to_Win[ SDLK_KP_0 ] = (U32)WindowsVK::VK_NUMPAD0;
+ mSDL2_to_Win[ SDLK_KP_1 ] = (U32)WindowsVK::VK_NUMPAD1;
+ mSDL2_to_Win[ SDLK_KP_2 ] = (U32)WindowsVK::VK_NUMPAD2;
+ mSDL2_to_Win[ SDLK_KP_3 ] = (U32)WindowsVK::VK_NUMPAD3;
+ mSDL2_to_Win[ SDLK_KP_4 ] = (U32)WindowsVK::VK_NUMPAD4;
+ mSDL2_to_Win[ SDLK_KP_5 ] = (U32)WindowsVK::VK_NUMPAD5;
+ mSDL2_to_Win[ SDLK_KP_6 ] = (U32)WindowsVK::VK_NUMPAD6;
+ mSDL2_to_Win[ SDLK_KP_7 ] = (U32)WindowsVK::VK_NUMPAD7;
+ mSDL2_to_Win[ SDLK_KP_8 ] = (U32)WindowsVK::VK_NUMPAD8;
+ mSDL2_to_Win[ SDLK_KP_9 ] = (U32)WindowsVK::VK_NUMPAD9;
+
+ // ?
+
+ mSDL2_to_Win[ SDLK_UP ] = (U32)WindowsVK::VK_UP;
+ mSDL2_to_Win[ SDLK_DOWN ] = (U32)WindowsVK::VK_DOWN;
+ mSDL2_to_Win[ SDLK_RIGHT ] = (U32)WindowsVK::VK_RIGHT;
+ mSDL2_to_Win[ SDLK_LEFT ] = (U32)WindowsVK::VK_LEFT;
+ mSDL2_to_Win[ SDLK_INSERT ] = (U32)WindowsVK::VK_INSERT;
+ mSDL2_to_Win[ SDLK_HOME ] = (U32)WindowsVK::VK_HOME;
+ mSDL2_to_Win[ SDLK_END ] = (U32)WindowsVK::VK_END;
+ mSDL2_to_Win[ SDLK_PAGEUP ] = (U32)WindowsVK::VK_PRIOR;
+ mSDL2_to_Win[ SDLK_PAGEDOWN ] = (U32)WindowsVK::VK_NEXT;
+ mSDL2_to_Win[ SDLK_F1 ] = (U32)WindowsVK::VK_F1;
+ mSDL2_to_Win[ SDLK_F2 ] = (U32)WindowsVK::VK_F2;
+ mSDL2_to_Win[ SDLK_F3 ] = (U32)WindowsVK::VK_F3;
+ mSDL2_to_Win[ SDLK_F4 ] = (U32)WindowsVK::VK_F4;
+ mSDL2_to_Win[ SDLK_F5 ] = (U32)WindowsVK::VK_F5;
+ mSDL2_to_Win[ SDLK_F6 ] = (U32)WindowsVK::VK_F6;
+ mSDL2_to_Win[ SDLK_F7 ] = (U32)WindowsVK::VK_F7;
+ mSDL2_to_Win[ SDLK_F8 ] = (U32)WindowsVK::VK_F8;
+ mSDL2_to_Win[ SDLK_F9 ] = (U32)WindowsVK::VK_F9;
+ mSDL2_to_Win[ SDLK_F10 ] = (U32)WindowsVK::VK_F10;
+ mSDL2_to_Win[ SDLK_F11 ] = (U32)WindowsVK::VK_F11;
+ mSDL2_to_Win[ SDLK_F12 ] = (U32)WindowsVK::VK_F12;
+ mSDL2_to_Win[ SDLK_F13 ] = (U32)WindowsVK::VK_F13;
+ mSDL2_to_Win[ SDLK_F14 ] = (U32)WindowsVK::VK_F14;
+ mSDL2_to_Win[ SDLK_F15 ] = (U32)WindowsVK::VK_F15;
+ mSDL2_to_Win[ SDLK_CAPSLOCK ] = (U32)WindowsVK::VK_CAPITAL;
+ mSDL2_to_Win[ SDLK_RSHIFT ] = (U32)WindowsVK::VK_SHIFT;
+ mSDL2_to_Win[ SDLK_LSHIFT ] = (U32)WindowsVK::VK_SHIFT;
+ mSDL2_to_Win[ SDLK_RCTRL ] = (U32)WindowsVK::VK_CONTROL;
+ mSDL2_to_Win[ SDLK_LCTRL ] = (U32)WindowsVK::VK_CONTROL;
+ mSDL2_to_Win[ SDLK_RALT ] = (U32)WindowsVK::VK_MENU;
+ mSDL2_to_Win[ SDLK_LALT ] = (U32)WindowsVK::VK_MENU;
+
+ mSDL2_to_Win[ SDLK_MENU ] = (U32)WindowsVK::VK_MENU;
+
+ // VK_MODECHANGE ?
+ // mSDL2_to_Win[ SDLK_MODE ] = (U32)WindowsVK::VK_MODE;
+
+ // ?
+ // mSDL2_to_Win[ SDLK_SYSREQ ] = (U32)WindowsVK::VK_SYSREQ;
+ // mSDL2_to_Win[ SDLK_POWER ] = (U32)WindowsVK::VK_POWER;
+ // mSDL2_to_Win[ SDLK_UNDO ] = (U32)WindowsVK::VK_UNDO;
+ // mSDL2_to_Win[ SDLK_KP_EQUALS ] = (U32)WindowsVK::VK_EQUALS;
+ // mSDL2_to_Win[ 311 ] = (U32)WindowsVK::VK_LWIN;
+ // mSDL2_to_Win[ 312 ] = (U32)WindowsVK::VK_RWIN;
+ // mSDL2_to_Win[ SDLK_COLON ] = ?
+ }
+ auto itr = mSDL2_to_Win.find( aSymbol );
+ if( itr != mSDL2_to_Win.end() )
+ return itr->second;
+
+ return aSymbol;
+}
diff --git a/indra/llwindow/llkeyboardsdl.h b/indra/llwindow/llkeyboardsdl.h
index fd348b28f2..9ebff66865 100644
--- a/indra/llwindow/llkeyboardsdl.h
+++ b/indra/llwindow/llkeyboardsdl.h
@@ -1,8 +1,7 @@
/**
- * @file llkeyboardsdl.h
- * @brief Handler for assignable key bindings
+ * @author This module has many fathers, and it shows.
*
- * $LicenseInfo:firstyear=2004&license=viewerlgpl$
+ * $LicenseInfo:firstyear=2001&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
@@ -24,11 +23,11 @@
* $/LicenseInfo$
*/
-#ifndef LL_LLKEYBOARDSDL_H
-#define LL_LLKEYBOARDSDL_H
+#ifndef LL_LLKEYBOARDSDL2_H
+#define LL_LLKEYBOARDSDL2_H
#include "llkeyboard.h"
-#include "SDL/SDL.h"
+#include "SDL2/SDL.h"
class LLKeyboardSDL : public LLKeyboard
{
@@ -36,8 +35,8 @@ public:
LLKeyboardSDL();
/*virtual*/ ~LLKeyboardSDL() {};
- /*virtual*/ bool handleKeyUp(const U16 key, MASK mask);
- /*virtual*/ bool handleKeyDown(const U16 key, MASK mask);
+ /*virtual*/ bool handleKeyUp(const U32 key, MASK mask);
+ /*virtual*/ bool handleKeyDown(const U32 key, MASK mask);
/*virtual*/ void resetMaskKeys();
/*virtual*/ MASK currentMask(bool for_mouse_event);
/*virtual*/ void scanKeyboard();
@@ -45,11 +44,14 @@ public:
protected:
MASK updateModifiers(const U32 mask);
void setModifierKeyLevel( KEY key, bool new_state );
- bool translateNumpadKey( const U16 os_key, KEY *translated_key );
+ bool translateNumpadKey( const U32 os_key, KEY *translated_key );
U16 inverseTranslateNumpadKey(const KEY translated_key);
private:
- std::map<U16, KEY> mTranslateNumpadMap; // special map for translating OS keys to numpad keys
- std::map<KEY, U16> mInvTranslateNumpadMap; // inverse of the above
+ std::map<U32, KEY> mTranslateNumpadMap; // special map for translating OS keys to numpad keys
+ std::map<KEY, U32> mInvTranslateNumpadMap; // inverse of the above
+
+public:
+ static U32 mapSDL2toWin( U32 );
};
#endif
diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp
index ec0055fe60..8d6b8d9b93 100644
--- a/indra/llwindow/llkeyboardwin32.cpp
+++ b/indra/llwindow/llkeyboardwin32.cpp
@@ -28,7 +28,7 @@
#include "linden_common.h"
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include "llkeyboardwin32.h"
#include "llwindowcallbacks.h"
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index 7433ad6bd2..89f0d152c6 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -25,8 +25,6 @@
* $/LicenseInfo$
*/
-#if LL_SDL
-
#include "linden_common.h"
#include "llwindowsdl.h"
@@ -40,12 +38,9 @@
#include "lldir.h"
#include "llfindlocale.h"
-#if LL_GTK
-extern "C" {
-# include "gtk/gtk.h"
-}
-#include <locale.h>
-#endif // LL_GTK
+#ifdef LL_GLIB
+#include <glib.h>
+#endif
extern "C" {
# include "fontconfig/fontconfig.h"
@@ -57,6 +52,7 @@ extern "C" {
# include <unistd.h>
# include <sys/types.h>
# include <sys/wait.h>
+# include <stdio.h>
#endif // LL_LINUX
extern bool gDebugWindowProc;
@@ -97,100 +93,277 @@ void maybe_unlock_display(void)
}
-#if LL_GTK
-// Lazily initialize and check the runtime GTK version for goodness.
+#if LL_X11
// static
-bool LLWindowSDL::ll_try_gtk_init(void)
+Window LLWindowSDL::get_SDL_XWindowID(void)
{
- static bool done_gtk_diag = false;
- static bool gtk_is_good = false;
- static bool done_setlocale = false;
- static bool tried_gtk_init = false;
+ if (gWindowImplementation) {
+ return gWindowImplementation->mSDL_XWindowID;
+ }
+ return None;
+}
- if (!done_setlocale)
+//static
+Display* LLWindowSDL::get_SDL_Display(void)
+{
+ if (gWindowImplementation) {
+ return gWindowImplementation->mSDL_Display;
+ }
+ return NULL;
+}
+#endif // LL_X11
+
+#if LL_X11
+
+// Clipboard handing via native X11, base on the implementation in Cool VL by Henri Beauchamp
+
+namespace
+{
+ std::array<Atom, 3> gSupportedAtoms;
+
+ Atom XA_CLIPBOARD;
+ Atom XA_TARGETS;
+ Atom PVT_PASTE_BUFFER;
+ long const MAX_PASTE_BUFFER_SIZE = 16383;
+
+ void filterSelectionRequest( XEvent aEvent )
{
- LL_INFOS() << "Starting GTK Initialization." << LL_ENDL;
- maybe_lock_display();
- gtk_disable_setlocale();
- maybe_unlock_display();
- done_setlocale = true;
+ auto *display = LLWindowSDL::getSDLDisplay();
+ auto &request = aEvent.xselectionrequest;
+
+ XSelectionEvent reply { SelectionNotify, aEvent.xany.serial, aEvent.xany.send_event, display,
+ request.requestor, request.selection, request.target,
+ request.property,request.time };
+
+ if (request.target == XA_TARGETS)
+ {
+ XChangeProperty(display, request.requestor, request.property,
+ XA_ATOM, 32, PropModeReplace,
+ (unsigned char *) &gSupportedAtoms.front(), gSupportedAtoms.size());
+ }
+ else if (std::find(gSupportedAtoms.begin(), gSupportedAtoms.end(), request.target) !=
+ gSupportedAtoms.end())
+ {
+ std::string utf8;
+ if (request.selection == XA_PRIMARY)
+ utf8 = wstring_to_utf8str(gWindowImplementation->getPrimaryText());
+ else
+ utf8 = wstring_to_utf8str(gWindowImplementation->getSecondaryText());
+
+ XChangeProperty(display, request.requestor, request.property,
+ request.target, 8, PropModeReplace,
+ (unsigned char *) utf8.c_str(), utf8.length());
+ }
+ else if (request.selection == XA_CLIPBOARD)
+ {
+ // Did not have what they wanted, so no property set
+ reply.property = None;
+ }
+ else
+ return;
+
+ XSendEvent(request.display, request.requestor, False, NoEventMask, (XEvent *) &reply);
+ XSync(display, False);
}
- if (!tried_gtk_init)
+ void filterSelectionClearRequest( XEvent aEvent )
{
- tried_gtk_init = true;
- if (!g_thread_supported ()) g_thread_init (NULL);
- maybe_lock_display();
- gtk_is_good = gtk_init_check(NULL, NULL);
- maybe_unlock_display();
- if (!gtk_is_good)
- LL_WARNS() << "GTK Initialization failed." << LL_ENDL;
+ auto &request = aEvent.xselectionrequest;
+ if (request.selection == XA_PRIMARY)
+ gWindowImplementation->clearPrimaryText();
+ else if (request.selection == XA_CLIPBOARD)
+ gWindowImplementation->clearSecondaryText();
+ }
+
+ int x11_clipboard_filter(void*, SDL_Event *evt)
+ {
+ Display *display = LLWindowSDL::getSDLDisplay();
+ if (!display)
+ return 1;
+
+ if (evt->type != SDL_SYSWMEVENT)
+ return 1;
+
+ auto xevent = evt->syswm.msg->msg.x11.event;
+
+ if (xevent.type == SelectionRequest)
+ filterSelectionRequest( xevent );
+ else if (xevent.type == SelectionClear)
+ filterSelectionClearRequest( xevent );
+ return 1;
}
- if (gtk_is_good && !done_gtk_diag)
+ bool grab_property(Display* display, Window window, Atom selection, Atom target)
{
- LL_INFOS() << "GTK Initialized." << LL_ENDL;
- LL_INFOS() << "- Compiled against GTK version "
- << GTK_MAJOR_VERSION << "."
- << GTK_MINOR_VERSION << "."
- << GTK_MICRO_VERSION << LL_ENDL;
- LL_INFOS() << "- Running against GTK version "
- << gtk_major_version << "."
- << gtk_minor_version << "."
- << gtk_micro_version << LL_ENDL;
+ if( !display )
+ return false;
+
maybe_lock_display();
- const gchar* gtk_warning = gtk_check_version(
- GTK_MAJOR_VERSION,
- GTK_MINOR_VERSION,
- GTK_MICRO_VERSION);
+
+ XDeleteProperty(display, window, PVT_PASTE_BUFFER);
+ XFlush(display);
+
+ XConvertSelection(display, selection, target, PVT_PASTE_BUFFER, window, CurrentTime);
+
+ // Unlock the connection so that the SDL event loop may function
maybe_unlock_display();
- if (gtk_warning)
+
+ const auto start{ SDL_GetTicks() };
+ const auto end{ start + 1000 };
+
+ XEvent xevent {};
+ bool response = false;
+
+ do
{
- LL_WARNS() << "- GTK COMPATIBILITY WARNING: " <<
- gtk_warning << LL_ENDL;
- gtk_is_good = false;
- } else {
- LL_INFOS() << "- GTK version is good." << LL_ENDL;
- }
+ SDL_Event event {};
+
+ // Wait for an event
+ SDL_WaitEvent(&event);
+
+ // If the event is a window manager event
+ if (event.type == SDL_SYSWMEVENT)
+ {
+ xevent = event.syswm.msg->msg.x11.event;
+
+ if (xevent.type == SelectionNotify && xevent.xselection.requestor == window)
+ response = true;
+ }
+ } while (!response && SDL_GetTicks() < end );
- done_gtk_diag = true;
+ return response && xevent.xselection.property != None;
}
+}
+
+void LLWindowSDL::initialiseX11Clipboard()
+{
+ if (!mSDL_Display)
+ return;
+
+ SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
+ SDL_SetEventFilter(x11_clipboard_filter, nullptr);
- return gtk_is_good;
+ maybe_lock_display();
+
+ XA_CLIPBOARD = XInternAtom(mSDL_Display, "CLIPBOARD", False);
+
+ gSupportedAtoms[0] = XInternAtom(mSDL_Display, "UTF8_STRING", False);
+ gSupportedAtoms[1] = XInternAtom(mSDL_Display, "COMPOUND_TEXT", False);
+ gSupportedAtoms[2] = XA_STRING;
+
+ // TARGETS atom
+ XA_TARGETS = XInternAtom(mSDL_Display, "TARGETS", False);
+
+ // SL_PASTE_BUFFER atom
+ PVT_PASTE_BUFFER = XInternAtom(mSDL_Display, "FS_PASTE_BUFFER", False);
+
+ maybe_unlock_display();
}
-#endif // LL_GTK
+bool LLWindowSDL::getSelectionText( Atom aSelection, Atom aType, LLWString &text )
+{
+ if( !mSDL_Display )
+ return false;
-#if LL_X11
-// static
-Window LLWindowSDL::get_SDL_XWindowID(void)
+ if( !grab_property(mSDL_Display, mSDL_XWindowID, aSelection,aType ) )
+ return false;
+
+ maybe_lock_display();
+
+ Atom type;
+ int format{};
+ unsigned long len{},remaining {};
+ unsigned char* data = nullptr;
+ int res = XGetWindowProperty(mSDL_Display, mSDL_XWindowID,
+ PVT_PASTE_BUFFER, 0, MAX_PASTE_BUFFER_SIZE, False,
+ AnyPropertyType, &type, &format, &len,
+ &remaining, &data);
+ if (data && len)
+ {
+ text = LLWString(
+ utf8str_to_wstring(reinterpret_cast< char const *>( data ) )
+ );
+ XFree(data);
+ }
+
+ maybe_unlock_display();
+ return res == Success;
+}
+
+bool LLWindowSDL::getSelectionText(Atom selection, LLWString& text)
{
- if (gWindowImplementation) {
- return gWindowImplementation->mSDL_XWindowID;
+ if (!mSDL_Display)
+ return false;
+
+ maybe_lock_display();
+
+ Window owner = XGetSelectionOwner(mSDL_Display, selection);
+ if (owner == None)
+ {
+ if (selection == XA_PRIMARY)
+ {
+ owner = DefaultRootWindow(mSDL_Display);
+ selection = XA_CUT_BUFFER0;
+ }
+ else
+ {
+ maybe_unlock_display();
+ return false;
+ }
}
- return None;
+
+ maybe_unlock_display();
+
+ for( Atom atom : gSupportedAtoms )
+ {
+ if(getSelectionText(selection, atom, text ) )
+ return true;
+ }
+
+ return false;
}
-//static
-Display* LLWindowSDL::get_SDL_Display(void)
+bool LLWindowSDL::setSelectionText(Atom selection, const LLWString& text)
{
- if (gWindowImplementation) {
- return gWindowImplementation->mSDL_Display;
+ maybe_lock_display();
+
+ if (selection == XA_PRIMARY)
+ {
+ std::string utf8 = wstring_to_utf8str(text);
+ XStoreBytes(mSDL_Display, utf8.c_str(), utf8.length() + 1);
+ mPrimaryClipboard = text;
}
- return NULL;
+ else
+ mSecondaryClipboard = text;
+
+ XSetSelectionOwner(mSDL_Display, selection, mSDL_XWindowID, CurrentTime);
+
+ auto owner = XGetSelectionOwner(mSDL_Display, selection);
+
+ maybe_unlock_display();
+
+ return owner == mSDL_XWindowID;
}
-#endif // LL_X11
+
+Display* LLWindowSDL::getSDLDisplay()
+{
+ if (gWindowImplementation)
+ return gWindowImplementation->mSDL_Display;
+ return nullptr;
+}
+
+#endif
LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
- const std::string& title, S32 x, S32 y, S32 width,
- S32 height, U32 flags,
- bool fullscreen, bool clearBg,
- bool disable_vsync, bool use_gl,
- bool ignore_pixel_depth, U32 fsaa_samples)
- : LLWindow(callbacks, fullscreen, flags),
- Lock_Display(NULL),
- Unlock_Display(NULL), mGamma(1.0f)
+ const std::string& title, S32 x, S32 y, S32 width,
+ S32 height, U32 flags,
+ bool fullscreen, bool clearBg,
+ bool enable_vsync, bool use_gl,
+ bool ignore_pixel_depth, U32 fsaa_samples)
+ : LLWindow(callbacks, fullscreen, flags),
+ Lock_Display(NULL),
+ Unlock_Display(NULL), mGamma(1.0f)
{
// Initialize the keyboard
gKeyboard = new LLKeyboardSDL();
@@ -199,6 +372,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
// Ignore use_gl for now, only used for drones on PC
mWindow = NULL;
+ mContext = {};
mNeedsResize = false;
mOverrideAspectRatio = 0.f;
mGrabbyKeyFlags = 0;
@@ -209,16 +383,9 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
#if LL_X11
mSDL_XWindowID = None;
- mSDL_Display = NULL;
+ mSDL_Display = nullptr;
#endif // LL_X11
-#if LL_GTK
- // We MUST be the first to initialize GTK so that GTK doesn't get badly
- // initialized with a non-C locale and cause lots of serious random
- // weirdness.
- ll_try_gtk_init();
-#endif // LL_GTK
-
// Assume 4:3 aspect ratio until we know better
mOriginalAspectRatio = 1024.0 / 768.0;
@@ -228,7 +395,7 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
mWindowTitle = title;
// Create the GL context and set it up for windowed or fullscreen, as appropriate.
- if(createContext(x, y, width, height, 32, fullscreen, disable_vsync))
+ if(createContext(x, y, width, height, 32, fullscreen, enable_vsync))
{
gGLManager.initGL();
@@ -244,9 +411,9 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks,
#if LL_X11
mFlashing = false;
+ initialiseX11Clipboard();
#endif // LL_X11
- mKeyScanCode = 0;
mKeyVirtualKey = 0;
mKeyModifiers = KMOD_NONE;
}
@@ -258,10 +425,10 @@ static SDL_Surface *Load_BMP_Resource(const char *basename)
// Figure out where our BMP is living on the disk
snprintf(path_buffer, PATH_BUFFER_SIZE-1, "%s%sres-sdl%s%s",
- gDirUtilp->getAppRODataDir().c_str(),
- gDirUtilp->getDirDelimiter().c_str(),
- gDirUtilp->getDirDelimiter().c_str(),
- basename);
+ gDirUtilp->getAppRODataDir().c_str(),
+ gDirUtilp->getDirDelimiter().c_str(),
+ gDirUtilp->getDirDelimiter().c_str(),
+ basename);
path_buffer[PATH_BUFFER_SIZE-1] = '\0';
return SDL_LoadBMP(path_buffer);
@@ -348,7 +515,7 @@ static int x11_detect_VRAM_kb()
if (fp)
{
LL_INFOS() << "Looking in " << fname
- << " for VRAM info..." << LL_ENDL;
+ << " for VRAM info..." << LL_ENDL;
rtn = x11_detect_VRAM_kb_fp(fp, ": VideoRAM: ");
fclose(fp);
if (0 == rtn)
@@ -373,7 +540,7 @@ static int x11_detect_VRAM_kb()
else
{
LL_INFOS() << "Could not open " << fname
- << " - skipped." << LL_ENDL;
+ << " - skipped." << LL_ENDL;
// Try old XFree86 log otherwise
fname = x_log_location;
fname += "XFree86.";
@@ -383,7 +550,7 @@ static int x11_detect_VRAM_kb()
if (fp)
{
LL_INFOS() << "Looking in " << fname
- << " for VRAM info..." << LL_ENDL;
+ << " for VRAM info..." << LL_ENDL;
rtn = x11_detect_VRAM_kb_fp(fp, ": VideoRAM: ");
fclose(fp);
if (0 == rtn)
@@ -399,95 +566,160 @@ static int x11_detect_VRAM_kb()
else
{
LL_INFOS() << "Could not open " << fname
- << " - skipped." << LL_ENDL;
+ << " - skipped." << LL_ENDL;
}
}
return rtn;
}
#endif // LL_X11
-bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool disable_vsync)
+void LLWindowSDL::setTitle(const std::string title)
+{
+ SDL_SetWindowTitle( mWindow, title.c_str() );
+}
+
+void LLWindowSDL::tryFindFullscreenSize( int &width, int &height )
+{
+ LL_INFOS() << "createContext: setting up fullscreen " << width << "x" << height << LL_ENDL;
+
+ // If the requested width or height is 0, find the best default for the monitor.
+ if((width == 0) || (height == 0))
+ {
+ // Scan through the list of modes, looking for one which has:
+ // height between 700 and 800
+ // aspect ratio closest to the user's original mode
+ S32 resolutionCount = 0;
+ LLWindowResolution *resolutionList = getSupportedResolutions(resolutionCount);
+
+ if(resolutionList != NULL)
+ {
+ F32 closestAspect = 0;
+ U32 closestHeight = 0;
+ U32 closestWidth = 0;
+ int i;
+
+ LL_INFOS() << "createContext: searching for a display mode, original aspect is " << mOriginalAspectRatio << LL_ENDL;
+
+ for(i=0; i < resolutionCount; i++)
+ {
+ F32 aspect = (F32)resolutionList[i].mWidth / (F32)resolutionList[i].mHeight;
+
+ LL_INFOS() << "createContext: width " << resolutionList[i].mWidth << " height " << resolutionList[i].mHeight << " aspect " << aspect << LL_ENDL;
+
+ if( (resolutionList[i].mHeight >= 700) && (resolutionList[i].mHeight <= 800) &&
+ (fabs(aspect - mOriginalAspectRatio) < fabs(closestAspect - mOriginalAspectRatio)))
+ {
+ LL_INFOS() << " (new closest mode) " << LL_ENDL;
+
+ // This is the closest mode we've seen yet.
+ closestWidth = resolutionList[i].mWidth;
+ closestHeight = resolutionList[i].mHeight;
+ closestAspect = aspect;
+ }
+ }
+
+ width = closestWidth;
+ height = closestHeight;
+ }
+ }
+
+ if((width == 0) || (height == 0))
+ {
+ // Mode search failed for some reason. Use the old-school default.
+ width = 1024;
+ height = 768;
+ }
+}
+
+bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool enable_vsync)
{
//bool glneedsinit = false;
LL_INFOS() << "createContext, fullscreen=" << fullscreen <<
- " size=" << width << "x" << height << LL_ENDL;
+ " size=" << width << "x" << height << LL_ENDL;
// captures don't survive contexts
mGrabbyKeyFlags = 0;
mReallyCapturedCount = 0;
- if (SDL_Init(SDL_INIT_VIDEO) < 0)
+ std::initializer_list<std::tuple< char const*, char const * > > hintList =
+ {
+ {SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR,"0"},
+ {SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH,"1"},
+ {SDL_HINT_IME_INTERNAL_EDITING,"1"}
+ };
+
+ for( auto hint: hintList )
{
- LL_INFOS() << "sdl_init() failed! " << SDL_GetError() << LL_ENDL;
- setupFailure("sdl_init() failure, window creation error", "error", OSMB_OK);
- return false;
+ SDL_SetHint( std::get<0>(hint), std::get<1>(hint));
+ }
+
+ std::initializer_list<std::tuple<uint32_t, char const*, bool>> initList=
+ { {SDL_INIT_VIDEO,"SDL_INIT_VIDEO", true},
+ {SDL_INIT_AUDIO,"SDL_INIT_AUDIO", false},
+ {SDL_INIT_GAMECONTROLLER,"SDL_INIT_GAMECONTROLLER", false},
+ {SDL_INIT_SENSOR,"SDL_INIT_SENSOR", false}
+ };
+
+ for( auto subSystem : initList)
+ {
+ if( SDL_InitSubSystem( std::get<0>(subSystem) ) < 0 )
+ {
+ LL_WARNS() << "SDL_InitSubSystem for " << std::get<1>(subSystem) << " failed " << SDL_GetError() << LL_ENDL;
+
+ if( std::get<2>(subSystem))
+ setupFailure("SDL_Init() failure", "error", OSMB_OK);
+
+ }
}
SDL_version c_sdl_version;
SDL_VERSION(&c_sdl_version);
LL_INFOS() << "Compiled against SDL "
- << int(c_sdl_version.major) << "."
- << int(c_sdl_version.minor) << "."
- << int(c_sdl_version.patch) << LL_ENDL;
- const SDL_version *r_sdl_version;
- r_sdl_version = SDL_Linked_Version();
+ << int(c_sdl_version.major) << "."
+ << int(c_sdl_version.minor) << "."
+ << int(c_sdl_version.patch) << LL_ENDL;
+ SDL_version r_sdl_version;
+ SDL_GetVersion(&r_sdl_version);
LL_INFOS() << " Running against SDL "
- << int(r_sdl_version->major) << "."
- << int(r_sdl_version->minor) << "."
- << int(r_sdl_version->patch) << LL_ENDL;
+ << int(r_sdl_version.major) << "."
+ << int(r_sdl_version.minor) << "."
+ << int(r_sdl_version.patch) << LL_ENDL;
- const SDL_VideoInfo *video_info = SDL_GetVideoInfo( );
- if (!video_info)
- {
- LL_INFOS() << "SDL_GetVideoInfo() failed! " << SDL_GetError() << LL_ENDL;
- setupFailure("SDL_GetVideoInfo() failed, Window creation error", "Error", OSMB_OK);
- return false;
- }
+ if (width == 0)
+ width = 1024;
+ if (height == 0)
+ width = 768;
- if (video_info->current_h > 0)
- {
- mOriginalAspectRatio = (float)video_info->current_w / (float)video_info->current_h;
- LL_INFOS() << "Original aspect ratio was " << video_info->current_w << ":" << video_info->current_h << "=" << mOriginalAspectRatio << LL_ENDL;
- }
+ mFullscreen = fullscreen;
- SDL_EnableUNICODE(1);
- SDL_WM_SetCaption(mWindowTitle.c_str(), mWindowTitle.c_str());
+ int sdlflags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE;
- // Set the application icon.
- SDL_Surface *bmpsurface;
- bmpsurface = Load_BMP_Resource("ll_icon.BMP");
- if (bmpsurface)
+ if( mFullscreen )
{
- // This attempts to give a black-keyed mask to the icon.
- SDL_SetColorKey(bmpsurface,
- SDL_SRCCOLORKEY,
- SDL_MapRGB(bmpsurface->format, 0,0,0) );
- SDL_WM_SetIcon(bmpsurface, NULL);
- // The SDL examples cheerfully avoid freeing the icon
- // surface, but I'm betting that's leaky.
- SDL_FreeSurface(bmpsurface);
- bmpsurface = NULL;
+ sdlflags |= SDL_WINDOW_FULLSCREEN;
+ tryFindFullscreenSize( width, height );
}
- // note: these SetAttributes make Tom's 9600-on-AMD64 fail to
- // get a visual, but it's broken anyway when it does, and without
- // these SetAttributes we might easily get an avoidable substandard
- // visual to work with on most other machines.
- SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,8);
- SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, (bits <= 16) ? 16 : 24);
- // We need stencil support for a few (minor) things.
- if (!getenv("LL_GL_NO_STENCIL"))
- SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
- SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, (bits <= 16) ? 1 : 8);
+ mSDLFlags = sdlflags;
- // *FIX: try to toggle vsync here?
+ GLint redBits{8}, greenBits{8}, blueBits{8}, alphaBits{8};
- mFullscreen = fullscreen;
+ GLint depthBits{(bits <= 16) ? 16 : 24}, stencilBits{8};
+
+ if (getenv("LL_GL_NO_STENCIL"))
+ stencilBits = 0;
- int sdlflags = SDL_OPENGL | SDL_RESIZABLE | SDL_ANYFORMAT;
+ SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, alphaBits);
+ SDL_GL_SetAttribute(SDL_GL_RED_SIZE, redBits);
+ SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, greenBits);
+ SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, blueBits);
+ SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, depthBits );
+
+ // We need stencil support for a few (minor) things.
+ if (stencilBits)
+ SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, stencilBits);
+ // *FIX: try to toggle vsync here?
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
@@ -497,80 +729,39 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, mFSAASamples);
}
- mSDLFlags = sdlflags;
+ SDL_GL_SetAttribute(SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 1);
+ mWindow = SDL_CreateWindow( mWindowTitle.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, mSDLFlags );
- if (mFullscreen)
+ if( mWindow )
{
- LL_INFOS() << "createContext: setting up fullscreen " << width << "x" << height << LL_ENDL;
-
- // If the requested width or height is 0, find the best default for the monitor.
- if((width == 0) || (height == 0))
- {
- // Scan through the list of modes, looking for one which has:
- // height between 700 and 800
- // aspect ratio closest to the user's original mode
- S32 resolutionCount = 0;
- LLWindowResolution *resolutionList = getSupportedResolutions(resolutionCount);
-
- if(resolutionList != NULL)
- {
- F32 closestAspect = 0;
- U32 closestHeight = 0;
- U32 closestWidth = 0;
- int i;
-
- LL_INFOS() << "createContext: searching for a display mode, original aspect is " << mOriginalAspectRatio << LL_ENDL;
-
- for(i=0; i < resolutionCount; i++)
- {
- F32 aspect = (F32)resolutionList[i].mWidth / (F32)resolutionList[i].mHeight;
-
- LL_INFOS() << "createContext: width " << resolutionList[i].mWidth << " height " << resolutionList[i].mHeight << " aspect " << aspect << LL_ENDL;
+ mContext = SDL_GL_CreateContext( mWindow );
- if( (resolutionList[i].mHeight >= 700) && (resolutionList[i].mHeight <= 800) &&
- (fabs(aspect - mOriginalAspectRatio) < fabs(closestAspect - mOriginalAspectRatio)))
- {
- LL_INFOS() << " (new closest mode) " << LL_ENDL;
-
- // This is the closest mode we've seen yet.
- closestWidth = resolutionList[i].mWidth;
- closestHeight = resolutionList[i].mHeight;
- closestAspect = aspect;
- }
- }
-
- width = closestWidth;
- height = closestHeight;
- }
- }
-
- if((width == 0) || (height == 0))
+ if( mContext == 0 )
{
- // Mode search failed for some reason. Use the old-school default.
- width = 1024;
- height = 768;
+ LL_WARNS() << "Cannot create GL context " << SDL_GetError() << LL_ENDL;
+ setupFailure("GL Context creation error creation error", "Error", OSMB_OK);
+ return false;
}
+ // SDL_GL_SetSwapInterval(1);
+ mSurface = SDL_GetWindowSurface( mWindow );
+ }
- mWindow = SDL_SetVideoMode(width, height, bits, sdlflags | SDL_FULLSCREEN);
- if (!mWindow && bits > 16)
- {
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
- mWindow = SDL_SetVideoMode(width, height, bits, sdlflags | SDL_FULLSCREEN);
- }
- if (mWindow)
+ if( mFullscreen )
+ {
+ if (mSurface)
{
mFullscreen = true;
- mFullscreenWidth = mWindow->w;
- mFullscreenHeight = mWindow->h;
- mFullscreenBits = mWindow->format->BitsPerPixel;
+ mFullscreenWidth = mSurface->w;
+ mFullscreenHeight = mSurface->h;
+ mFullscreenBits = mSurface->format->BitsPerPixel;
mFullscreenRefresh = -1;
LL_INFOS() << "Running at " << mFullscreenWidth
- << "x" << mFullscreenHeight
- << "x" << mFullscreenBits
- << " @ " << mFullscreenRefresh
- << LL_ENDL;
+ << "x" << mFullscreenHeight
+ << "x" << mFullscreenBits
+ << " @ " << mFullscreenRefresh
+ << LL_ENDL;
}
else
{
@@ -584,33 +775,27 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
std::string error = llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height);
OSMessageBox(error, "Error", OSMB_OK);
+ return false;
}
}
-
- if(!mFullscreen && (mWindow == NULL))
+ else
{
- if (width == 0)
- width = 1024;
- if (height == 0)
- width = 768;
-
- LL_INFOS() << "createContext: creating window " << width << "x" << height << "x" << bits << LL_ENDL;
- mWindow = SDL_SetVideoMode(width, height, bits, sdlflags);
- if (!mWindow && bits > 16)
- {
- SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
- mWindow = SDL_SetVideoMode(width, height, bits, sdlflags);
- }
-
if (!mWindow)
{
LL_WARNS() << "createContext: window creation failure. SDL: " << SDL_GetError() << LL_ENDL;
setupFailure("Window creation error", "Error", OSMB_OK);
return false;
}
- } else if (!mFullscreen && (mWindow != NULL))
+ }
+
+ // Set the application icon.
+ SDL_Surface *bmpsurface;
+ bmpsurface = Load_BMP_Resource("ll_icon.BMP");
+ if (bmpsurface)
{
- LL_INFOS() << "createContext: SKIPPING - !fullscreen, but +mWindow " << width << "x" << height << "x" << bits << LL_ENDL;
+ SDL_SetWindowIcon(mWindow, bmpsurface);
+ SDL_FreeSurface(bmpsurface);
+ bmpsurface = NULL;
}
// Detect video memory size.
@@ -625,7 +810,7 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
// fallback to letting SDL detect VRAM.
// note: I've not seen SDL's detection ever actually find
// VRAM != 0, but if SDL *does* detect it then that's a bonus.
- gGLManager.mVRAM = video_info->video_mem / 1024;
+ gGLManager.mVRAM = 0;
if (gGLManager.mVRAM != 0)
{
LL_INFOS() << "SDL detected " << gGLManager.mVRAM << "MB VRAM." << LL_ENDL;
@@ -637,22 +822,20 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
// explicitly unsupported cards.
//const char* RENDERER = (const char*) glGetString(GL_RENDERER);
- GLint depthBits, stencilBits, redBits, greenBits, blueBits, alphaBits;
-
- glGetIntegerv(GL_RED_BITS, &redBits);
- glGetIntegerv(GL_GREEN_BITS, &greenBits);
- glGetIntegerv(GL_BLUE_BITS, &blueBits);
- glGetIntegerv(GL_ALPHA_BITS, &alphaBits);
- glGetIntegerv(GL_DEPTH_BITS, &depthBits);
- glGetIntegerv(GL_STENCIL_BITS, &stencilBits);
+ SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &redBits);
+ SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &greenBits);
+ SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &blueBits);
+ SDL_GL_GetAttribute(SDL_GL_ALPHA_SIZE, &alphaBits);
+ SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &depthBits);
+ SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &stencilBits);
LL_INFOS() << "GL buffer:" << LL_ENDL;
- LL_INFOS() << " Red Bits " << S32(redBits) << LL_ENDL;
- LL_INFOS() << " Green Bits " << S32(greenBits) << LL_ENDL;
- LL_INFOS() << " Blue Bits " << S32(blueBits) << LL_ENDL;
- LL_INFOS() << " Alpha Bits " << S32(alphaBits) << LL_ENDL;
- LL_INFOS() << " Depth Bits " << S32(depthBits) << LL_ENDL;
- LL_INFOS() << " Stencil Bits " << S32(stencilBits) << LL_ENDL;
+ LL_INFOS() << " Red Bits " << S32(redBits) << LL_ENDL;
+ LL_INFOS() << " Green Bits " << S32(greenBits) << LL_ENDL;
+ LL_INFOS() << " Blue Bits " << S32(blueBits) << LL_ENDL;
+ LL_INFOS() << " Alpha Bits " << S32(alphaBits) << LL_ENDL;
+ LL_INFOS() << " Depth Bits " << S32(depthBits) << LL_ENDL;
+ LL_INFOS() << " Stencil Bits " << S32(stencilBits) << LL_ENDL;
GLint colorBits = redBits + greenBits + blueBits + alphaBits;
// fixme: actually, it's REALLY important for picking that we get at
@@ -662,76 +845,53 @@ bool LLWindowSDL::createContext(int x, int y, int width, int height, int bits, b
{
close();
setupFailure(
- "Second Life requires True Color (32-bit) to run in a window.\n"
- "Please go to Control Panels -> Display -> Settings and\n"
- "set the screen to 32-bit color.\n"
- "Alternately, if you choose to run fullscreen, Second Life\n"
- "will automatically adjust the screen each time it runs.",
- "Error",
- OSMB_OK);
- return false;
- }
-
-#if 0 // *FIX: we're going to brave it for now...
- if (alphaBits < 8)
- {
- close();
- setupFailure(
- "Second Life is unable to run because it can't get an 8 bit alpha\n"
- "channel. Usually this is due to video card driver issues.\n"
- "Please make sure you have the latest video card drivers installed.\n"
- "Also be sure your monitor is set to True Color (32-bit) in\n"
- "Control Panels -> Display -> Settings.\n"
- "If you continue to receive this message, contact customer service.",
- "Error",
- OSMB_OK);
+ "Second Life requires True Color (32-bit) to run in a window.\n"
+ "Please go to Control Panels -> Display -> Settings and\n"
+ "set the screen to 32-bit color.\n"
+ "Alternately, if you choose to run fullscreen, Second Life\n"
+ "will automatically adjust the screen each time it runs.",
+ "Error",
+ OSMB_OK);
return false;
}
-#endif
#if LL_X11
/* Grab the window manager specific information */
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
- if ( SDL_GetWMInfo(&info) )
+ if ( SDL_GetWindowWMInfo(mWindow, &info) )
{
/* Save the information for later use */
if ( info.subsystem == SDL_SYSWM_X11 )
{
mSDL_Display = info.info.x11.display;
- mSDL_XWindowID = info.info.x11.wmwindow;
- Lock_Display = info.info.x11.lock_func;
- Unlock_Display = info.info.x11.unlock_func;
+ mSDL_XWindowID = info.info.x11.window;
}
else
{
LL_WARNS() << "We're not running under X11? Wild."
- << LL_ENDL;
+ << LL_ENDL;
}
}
else
{
LL_WARNS() << "We're not running under any known WM. Wild."
- << LL_ENDL;
+ << LL_ENDL;
}
#endif // LL_X11
+ SDL_StartTextInput();
//make sure multisampling is disabled by default
glDisable(GL_MULTISAMPLE_ARB);
- // We need to do this here, once video is init'd
- if (-1 == SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,
- SDL_DEFAULT_REPEAT_INTERVAL))
- LL_WARNS() << "Couldn't enable key-repeat: " << SDL_GetError() <<LL_ENDL;
-
// Don't need to get the current gamma, since there's a call that restores it to the system defaults.
return true;
}
// changing fullscreen resolution, or switching between windowed and fullscreen mode.
-bool LLWindowSDL::switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen * const posp)
+bool LLWindowSDL::switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync, const LLCoordScreen * const posp)
{
const bool needsRebuild = true; // Just nuke the context and start over.
bool result = true;
@@ -741,7 +901,7 @@ bool LLWindowSDL::switchContext(bool fullscreen, const LLCoordScreen &size, bool
if(needsRebuild)
{
destroyContext();
- result = createContext(0, 0, size.mX, size.mY, 0, fullscreen, disable_vsync);
+ result = createContext(0, 0, size.mX, size.mY, 0, fullscreen, enable_vsync);
if (result)
{
gGLManager.initGL();
@@ -761,6 +921,7 @@ void LLWindowSDL::destroyContext()
{
LL_INFOS() << "destroyContext begins" << LL_ENDL;
+ SDL_StopTextInput();
#if LL_X11
mSDL_Display = NULL;
mSDL_XWindowID = None;
@@ -894,11 +1055,11 @@ bool LLWindowSDL::getPosition(LLCoordScreen *position)
bool LLWindowSDL::getSize(LLCoordScreen *size)
{
- if (mWindow)
+ if (mSurface)
{
- size->mX = mWindow->w;
- size->mY = mWindow->h;
- return (true);
+ size->mX = mSurface->w;
+ size->mY = mSurface->h;
+ return (true);
}
return (false);
@@ -906,11 +1067,11 @@ bool LLWindowSDL::getSize(LLCoordScreen *size)
bool LLWindowSDL::getSize(LLCoordWindow *size)
{
- if (mWindow)
+ if (mSurface)
{
- size->mX = mWindow->w;
- size->mY = mWindow->h;
- return (true);
+ size->mX = mSurface->w;
+ size->mY = mSurface->h;
+ return (true);
}
return (false);
@@ -927,40 +1088,37 @@ bool LLWindowSDL::setPosition(const LLCoordScreen position)
return true;
}
-bool LLWindowSDL::setSizeImpl(const LLCoordScreen size)
+template< typename T > bool setSizeImpl( const T& newSize, SDL_Window *pWin )
{
- if(mWindow)
- {
- // Push a resize event onto SDL's queue - we'll handle it
- // when it comes out again.
- SDL_Event event;
- event.type = SDL_VIDEORESIZE;
- event.resize.w = size.mX;
- event.resize.h = size.mY;
- SDL_PushEvent(&event); // copied into queue
+ if( !pWin )
+ return false;
- return true;
- }
+ auto nFlags = SDL_GetWindowFlags( pWin );
- return false;
+ if( nFlags & SDL_WINDOW_MAXIMIZED )
+ SDL_RestoreWindow( pWin );
+
+
+ SDL_SetWindowSize( pWin, newSize.mX, newSize.mY );
+ SDL_Event event;
+ event.type = SDL_WINDOWEVENT;
+ event.window.event = SDL_WINDOWEVENT_RESIZED;
+ event.window.windowID = SDL_GetWindowID( pWin );
+ event.window.data1 = newSize.mX;
+ event.window.data2 = newSize.mY;
+ SDL_PushEvent( &event );
+
+ return true;
}
-bool LLWindowSDL::setSizeImpl(const LLCoordWindow size)
+bool LLWindowSDL::setSizeImpl(const LLCoordScreen size)
{
- if(mWindow)
- {
- // Push a resize event onto SDL's queue - we'll handle it
- // when it comes out again.
- SDL_Event event;
- event.type = SDL_VIDEORESIZE;
- event.resize.w = size.mX;
- event.resize.h = size.mY;
- SDL_PushEvent(&event); // copied into queue
-
- return true;
- }
+ return ::setSizeImpl( size, mWindow );
+}
- return false;
+bool LLWindowSDL::setSizeImpl(const LLCoordWindow size)
+{
+ return ::setSizeImpl( size, mWindow );
}
@@ -968,7 +1126,7 @@ void LLWindowSDL::swapBuffers()
{
if (mWindow)
{
- SDL_GL_SwapBuffers();
+ SDL_GL_SwapWindow( mWindow );
}
}
@@ -990,7 +1148,7 @@ F32 LLWindowSDL::getGamma()
bool LLWindowSDL::restoreGamma()
{
//CGDisplayRestoreColorSyncSettings();
- SDL_SetGamma(1.0f, 1.0f, 1.0f);
+ // SDL_SetGamma(1.0f, 1.0f, 1.0f);
return true;
}
@@ -999,7 +1157,7 @@ bool LLWindowSDL::setGamma(const F32 gamma)
mGamma = gamma;
if (mGamma == 0) mGamma = 0.1f;
mGamma = 1/mGamma;
- SDL_SetGamma(mGamma, mGamma, mGamma);
+ // SDL_SetGamma(mGamma, mGamma, mGamma);
return true;
}
@@ -1048,7 +1206,7 @@ bool LLWindowSDL::setCursorPosition(const LLCoordWindow position)
//LL_INFOS() << "setCursorPosition(" << screen_pos.mX << ", " << screen_pos.mY << ")" << LL_ENDL;
// do the actual forced cursor move.
- SDL_WarpMouse(screen_pos.mX, screen_pos.mY);
+ SDL_WarpMouseInWindow(mWindow, screen_pos.mX, screen_pos.mY);
//LL_INFOS() << llformat("llcw %d,%d -> scr %d,%d", position.mX, position.mY, screen_pos.mX, screen_pos.mY) << LL_ENDL;
@@ -1073,18 +1231,6 @@ bool LLWindowSDL::getCursorPosition(LLCoordWindow *position)
F32 LLWindowSDL::getNativeAspectRatio()
{
-#if 0
- // RN: this hack presumes that the largest supported resolution is monitor-limited
- // and that pixels in that mode are square, therefore defining the native aspect ratio
- // of the monitor...this seems to work to a close approximation for most CRTs/LCDs
- S32 num_resolutions;
- LLWindowResolution* resolutions = getSupportedResolutions(num_resolutions);
-
-
- return ((F32)resolutions[num_resolutions - 1].mWidth / (F32)resolutions[num_resolutions - 1].mHeight);
- //rn: AC
-#endif
-
// MBW -- there are a couple of bad assumptions here. One is that the display list won't include
// ridiculous resolutions nobody would ever use. The other is that the list is in order.
@@ -1146,7 +1292,7 @@ void LLWindowSDL::beforeDialog()
// it only works in X11
if (running_x11 && mWindow)
{
- SDL_WM_ToggleFullScreen(mWindow);
+ SDL_SetWindowFullscreen( mWindow, 0 );
}
}
}
@@ -1162,12 +1308,6 @@ void LLWindowSDL::beforeDialog()
}
#endif // LL_X11
-#if LL_GTK
- // this is a good time to grab some GTK version information for
- // diagnostics, if not already done.
- ll_try_gtk_init();
-#endif // LL_GTK
-
maybe_lock_display();
}
@@ -1188,7 +1328,7 @@ void LLWindowSDL::afterDialog()
// in X11
if (running_x11 && mWindow)
{
- SDL_WM_ToggleFullScreen(mWindow);
+ SDL_SetWindowFullscreen( mWindow, 0 );
}
}
}
@@ -1224,143 +1364,56 @@ void LLWindowSDL::x11_set_urgent(bool urgent)
void LLWindowSDL::flashIcon(F32 seconds)
{
+ if (getMinimized())
+ {
#if !LL_X11
- LL_INFOS() << "Stub LLWindowSDL::flashIcon(" << seconds << ")" << LL_ENDL;
+ LL_INFOS() << "Stub LLWindowSDL::flashIcon(" << seconds << ")" << LL_ENDL;
#else
- LL_INFOS() << "X11 LLWindowSDL::flashIcon(" << seconds << ")" << LL_ENDL;
+ LL_INFOS() << "X11 LLWindowSDL::flashIcon(" << seconds << ")" << LL_ENDL;
- F32 remaining_time = mFlashTimer.getRemainingTimeF32();
- if (remaining_time < seconds)
- remaining_time = seconds;
- mFlashTimer.reset();
- mFlashTimer.setTimerExpirySec(remaining_time);
+ F32 remaining_time = mFlashTimer.getRemainingTimeF32();
+ if (remaining_time < seconds)
+ remaining_time = seconds;
+ mFlashTimer.reset();
+ mFlashTimer.setTimerExpirySec(remaining_time);
- x11_set_urgent(true);
- mFlashing = true;
+ x11_set_urgent(true);
+ mFlashing = true;
#endif // LL_X11
-}
-
-
-#if LL_GTK
-bool LLWindowSDL::isClipboardTextAvailable()
-{
- if (ll_try_gtk_init())
- {
- GtkClipboard * const clipboard =
- gtk_clipboard_get(GDK_NONE);
- return gtk_clipboard_wait_is_text_available(clipboard) ?
- true : false;
- }
- return false; // failure
-}
-
-bool LLWindowSDL::pasteTextFromClipboard(LLWString &text)
-{
- if (ll_try_gtk_init())
- {
- GtkClipboard * const clipboard =
- gtk_clipboard_get(GDK_NONE);
- gchar * const data = gtk_clipboard_wait_for_text(clipboard);
- if (data)
- {
- text = LLWString(utf8str_to_wstring(data));
- g_free(data);
- return true;
- }
- }
- return false; // failure
-}
-
-bool LLWindowSDL::copyTextToClipboard(const LLWString &text)
-{
- if (ll_try_gtk_init())
- {
- const std::string utf8 = wstring_to_utf8str(text);
- GtkClipboard * const clipboard =
- gtk_clipboard_get(GDK_NONE);
- gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length());
- return true;
- }
- return false; // failure
-}
-
-
-bool LLWindowSDL::isPrimaryTextAvailable()
-{
- if (ll_try_gtk_init())
- {
- GtkClipboard * const clipboard =
- gtk_clipboard_get(GDK_SELECTION_PRIMARY);
- return gtk_clipboard_wait_is_text_available(clipboard) ?
- true : false;
- }
- return false; // failure
-}
-
-bool LLWindowSDL::pasteTextFromPrimary(LLWString &text)
-{
- if (ll_try_gtk_init())
- {
- GtkClipboard * const clipboard =
- gtk_clipboard_get(GDK_SELECTION_PRIMARY);
- gchar * const data = gtk_clipboard_wait_for_text(clipboard);
- if (data)
- {
- text = LLWString(utf8str_to_wstring(data));
- g_free(data);
- return true;
- }
- }
- return false; // failure
-}
-
-bool LLWindowSDL::copyTextToPrimary(const LLWString &text)
-{
- if (ll_try_gtk_init())
- {
- const std::string utf8 = wstring_to_utf8str(text);
- GtkClipboard * const clipboard =
- gtk_clipboard_get(GDK_SELECTION_PRIMARY);
- gtk_clipboard_set_text(clipboard, utf8.c_str(), utf8.length());
- return true;
}
- return false; // failure
}
-#else
-
bool LLWindowSDL::isClipboardTextAvailable()
{
- return false; // unsupported
+ return mSDL_Display && XGetSelectionOwner(mSDL_Display, XA_CLIPBOARD) != None;
}
bool LLWindowSDL::pasteTextFromClipboard(LLWString &dst)
{
- return false; // unsupported
+ return getSelectionText(XA_CLIPBOARD, dst);
}
bool LLWindowSDL::copyTextToClipboard(const LLWString &s)
{
- return false; // unsupported
+ return setSelectionText(XA_CLIPBOARD, s);
}
bool LLWindowSDL::isPrimaryTextAvailable()
{
- return false; // unsupported
+ LLWString text;
+ return getSelectionText(XA_PRIMARY, text) && !text.empty();
}
bool LLWindowSDL::pasteTextFromPrimary(LLWString &dst)
{
- return false; // unsupported
+ return getSelectionText(XA_PRIMARY, dst);
}
bool LLWindowSDL::copyTextToPrimary(const LLWString &s)
{
- return false; // unsupported
+ return setSelectionText(XA_PRIMARY, s);
}
-#endif // LL_GTK
-
LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_resolutions)
{
if (!mSupportedResolutions)
@@ -1368,33 +1421,30 @@ LLWindow::LLWindowResolution* LLWindowSDL::getSupportedResolutions(S32 &num_reso
mSupportedResolutions = new LLWindowResolution[MAX_NUM_RESOLUTIONS];
mNumSupportedResolutions = 0;
- SDL_Rect **modes = SDL_ListModes(NULL, SDL_OPENGL | SDL_FULLSCREEN);
- if ( (modes != NULL) && (modes != ((SDL_Rect **) -1)) )
+ // <FS:ND> Use display no from mWindow/mSurface here?
+ int max = SDL_GetNumDisplayModes(0);
+ max = llclamp( max, 0, MAX_NUM_RESOLUTIONS );
+
+ for( int i =0; i < max; ++i )
{
- int count = 0;
- while (*modes && count<MAX_NUM_RESOLUTIONS) // they're sorted biggest to smallest, so find end...
+ SDL_DisplayMode mode = { SDL_PIXELFORMAT_UNKNOWN, 0, 0, 0, 0 };
+ if (SDL_GetDisplayMode( 0 , i, &mode) != 0)
{
- modes++;
- count++;
+ continue;
}
- while (count--)
+ int w = mode.w;
+ int h = mode.h;
+ if ((w >= 800) && (h >= 600))
{
- modes--;
- SDL_Rect *r = *modes;
- int w = r->w;
- int h = r->h;
- if ((w >= 800) && (h >= 600))
+ // make sure we don't add the same resolution multiple times!
+ if ( (mNumSupportedResolutions == 0) ||
+ ((mSupportedResolutions[mNumSupportedResolutions-1].mWidth != w) &&
+ (mSupportedResolutions[mNumSupportedResolutions-1].mHeight != h)) )
{
- // make sure we don't add the same resolution multiple times!
- if ( (mNumSupportedResolutions == 0) ||
- ((mSupportedResolutions[mNumSupportedResolutions-1].mWidth != w) &&
- (mSupportedResolutions[mNumSupportedResolutions-1].mHeight != h)) )
- {
- mSupportedResolutions[mNumSupportedResolutions].mWidth = w;
- mSupportedResolutions[mNumSupportedResolutions].mHeight = h;
- mNumSupportedResolutions++;
- }
+ mSupportedResolutions[mNumSupportedResolutions].mWidth = w;
+ mSupportedResolutions[mNumSupportedResolutions].mHeight = h;
+ mNumSupportedResolutions++;
}
}
}
@@ -1410,7 +1460,7 @@ bool LLWindowSDL::convertCoords(LLCoordGL from, LLCoordWindow *to)
return false;
to->mX = from.mX;
- to->mY = mWindow->h - from.mY - 1;
+ to->mY = mSurface->h - from.mY - 1;
return true;
}
@@ -1421,7 +1471,7 @@ bool LLWindowSDL::convertCoords(LLCoordWindow from, LLCoordGL* to)
return false;
to->mX = from.mX;
- to->mY = mWindow->h - from.mY - 1;
+ to->mY = mSurface->h - from.mY - 1;
return true;
}
@@ -1482,13 +1532,13 @@ bool LLWindowSDL::SDLReallyCaptureInput(bool capture)
else
mReallyCapturedCount = 0;
- SDL_GrabMode wantmode, newmode;
+ bool wantGrab;
if (mReallyCapturedCount <= 0) // uncapture
{
- wantmode = SDL_GRAB_OFF;
+ wantGrab = false;
} else // capture
{
- wantmode = SDL_GRAB_ON;
+ wantGrab = true;
}
if (mReallyCapturedCount < 0) // yuck, imbalance.
@@ -1497,9 +1547,11 @@ bool LLWindowSDL::SDLReallyCaptureInput(bool capture)
LL_WARNS() << "ReallyCapture count was < 0" << LL_ENDL;
}
+ bool newGrab = wantGrab;
+
+#if LL_X11
if (!mFullscreen) /* only bother if we're windowed anyway */
{
-#if LL_X11
if (mSDL_Display)
{
/* we dirtily mix raw X11 with SDL so that our pointer
@@ -1512,49 +1564,37 @@ bool LLWindowSDL::SDLReallyCaptureInput(bool capture)
*keyboard* input from the window manager, which was
frustrating users. */
int result;
- if (wantmode == SDL_GRAB_ON)
+ if (wantGrab == true)
{
- //LL_INFOS() << "X11 POINTER GRABBY" << LL_ENDL;
- //newmode = SDL_WM_GrabInput(wantmode);
maybe_lock_display();
result = XGrabPointer(mSDL_Display, mSDL_XWindowID,
- True, 0, GrabModeAsync,
- GrabModeAsync,
- None, None, CurrentTime);
+ True, 0, GrabModeAsync,
+ GrabModeAsync,
+ None, None, CurrentTime);
maybe_unlock_display();
if (GrabSuccess == result)
- newmode = SDL_GRAB_ON;
+ newGrab = true;
else
- newmode = SDL_GRAB_OFF;
- } else if (wantmode == SDL_GRAB_OFF)
+ newGrab = false;
+ }
+ else
{
- //LL_INFOS() << "X11 POINTER UNGRABBY" << LL_ENDL;
- newmode = SDL_GRAB_OFF;
- //newmode = SDL_WM_GrabInput(SDL_GRAB_OFF);
+ newGrab = false;
maybe_lock_display();
XUngrabPointer(mSDL_Display, CurrentTime);
// Make sure the ungrab happens RIGHT NOW.
XSync(mSDL_Display, False);
maybe_unlock_display();
- } else
- {
- newmode = SDL_GRAB_QUERY; // neutral
}
- } else // not actually running on X11, for some reason
- newmode = wantmode;
-#endif // LL_X11
- } else {
- // pretend we got what we wanted, when really we don't care.
- newmode = wantmode;
+ }
}
-
+#endif // LL_X11
// return boolean success for whether we ended up in the desired state
- return (capture && SDL_GRAB_ON==newmode) ||
- (!capture && SDL_GRAB_OFF==newmode);
+ return capture == newGrab;
}
-U32 LLWindowSDL::SDLCheckGrabbyKeys(SDLKey keysym, bool gain)
+U32 LLWindowSDL::SDLCheckGrabbyKeys(U32 keysym, bool gain)
{
/* part of the fix for SL-13243: Some popular window managers like
to totally eat alt-drag for the purposes of moving windows. We
@@ -1572,16 +1612,16 @@ U32 LLWindowSDL::SDLCheckGrabbyKeys(SDLKey keysym, bool gain)
U32 mask = 0;
switch (keysym)
{
- case SDLK_LALT:
- mask = 1U << 0; break;
- case SDLK_RALT:
- mask = 1U << 1; break;
- case SDLK_LCTRL:
- mask = 1U << 2; break;
- case SDLK_RCTRL:
- mask = 1U << 3; break;
- default:
- break;
+ case SDLK_LALT:
+ mask = 1U << 0; break;
+ case SDLK_RALT:
+ mask = 1U << 1; break;
+ case SDLK_LCTRL:
+ mask = 1U << 2; break;
+ case SDLK_RCTRL:
+ mask = 1U << 3; break;
+ default:
+ break;
}
if (gain)
@@ -1679,7 +1719,7 @@ void check_vm_bloat()
last_rss_size = this_rss_size;
last_vm_size = this_vm_size;
-finally:
+ finally:
if (NULL != ptr)
{
free(ptr);
@@ -1694,33 +1734,17 @@ finally:
// virtual
void LLWindowSDL::processMiscNativeEvents()
{
-#if LL_GTK
- // Pump GTK events to avoid starvation for:
- // * DBUS servicing
- // * Anything else which quietly hooks into the default glib/GTK loop
- if (ll_try_gtk_init())
- {
- // Yuck, Mozilla's GTK callbacks play with the locale - push/pop
- // the locale to protect it, as exotic/non-C locales
- // causes our code lots of general critical weirdness
- // and crashness. (SL-35450)
- static std::string saved_locale;
- saved_locale = ll_safe_string(setlocale(LC_ALL, NULL));
-
- // Pump until we've nothing left to do or passed 1/15th of a
- // second pumping for this frame.
- static LLTimer pump_timer;
- pump_timer.reset();
- pump_timer.setTimerExpirySec(1.0f / 15.0f);
- do {
- // Always do at least one non-blocking pump
- gtk_main_iteration_do(false);
- } while (gtk_events_pending() &&
- !pump_timer.hasExpired());
-
- setlocale(LC_ALL, saved_locale.c_str() );
- }
-#endif // LL_GTK
+#if LL_GLIB
+ // Pump until we've nothing left to do or passed 1/15th of a
+ // second pumping for this frame.
+ static LLTimer pump_timer;
+ pump_timer.reset();
+ pump_timer.setTimerExpirySec(1.0f / 15.0f);
+ do
+ {
+ g_main_context_iteration(g_main_context_default(), false);
+ } while( g_main_context_pending(g_main_context_default()) && !pump_timer.hasExpired());
+#endif
// hack - doesn't belong here - but this is just for debugging
if (getenv("LL_DEBUG_BLOAT"))
@@ -1743,6 +1767,11 @@ void LLWindowSDL::gatherInput()
{
switch (event.type)
{
+ case SDL_MOUSEWHEEL:
+ if( event.wheel.y != 0 )
+ mCallbacks->handleScrollWheel(this, -event.wheel.y);
+ break;
+
case SDL_MOUSEMOTION:
{
LLCoordWindow winCoord(event.button.x, event.button.y);
@@ -1753,33 +1782,68 @@ void LLWindowSDL::gatherInput()
break;
}
+ case SDL_TEXTINPUT:
+ {
+ auto string = utf8str_to_utf16str( event.text.text );
+ mKeyModifiers = gKeyboard->currentMask( false );
+ mInputType = "textinput";
+ for( auto key: string )
+ {
+ mKeyVirtualKey = key;
+
+ if( (MASK_CONTROL|MASK_ALT)&mKeyModifiers )
+ gKeyboard->handleKeyDown(mKeyVirtualKey, mKeyModifiers );
+ else
+ handleUnicodeUTF16( key, mKeyModifiers );
+ }
+ break;
+ }
+
case SDL_KEYDOWN:
- mKeyScanCode = event.key.keysym.scancode;
- mKeyVirtualKey = event.key.keysym.unicode;
- mKeyModifiers = event.key.keysym.mod;
+ mKeyVirtualKey = event.key.keysym.sym;
+ mKeyModifiers = event.key.keysym.mod;
+ mInputType = "keydown";
- gKeyboard->handleKeyDown(event.key.keysym.sym, event.key.keysym.mod);
- // part of the fix for SL-13243
- if (SDLCheckGrabbyKeys(event.key.keysym.sym, true) != 0)
- SDLReallyCaptureInput(true);
+ // treat all possible Enter/Return keys the same
+ if (mKeyVirtualKey == SDLK_RETURN2 || mKeyVirtualKey == SDLK_KP_ENTER)
+ {
+ mKeyVirtualKey = SDLK_RETURN;
+ }
+
+ gKeyboard->handleKeyDown(mKeyVirtualKey, mKeyModifiers );
+
+ // <FS:ND> Slightly hacky :| To make the viewer honor enter (eg to accept form input) we've to not only send handleKeyDown but also send a
+ // invoke handleUnicodeUTF16 in case the user hits return.
+ // Note that we cannot blindly use handleUnicodeUTF16 for each SDL_KEYDOWN. Doing so will create bogus keyboard input (like % for cursor left).
+ if( mKeyVirtualKey == SDLK_RETURN )
+ {
+ // fix return key not working when capslock, scrolllock or numlock are enabled
+ mKeyModifiers &= (~(KMOD_NUM | KMOD_CAPS | KMOD_MODE | KMOD_SCROLL));
+ handleUnicodeUTF16( mKeyVirtualKey, mKeyModifiers );
+ }
+
+ // part of the fix for SL-13243
+ if (SDLCheckGrabbyKeys(event.key.keysym.sym, true) != 0)
+ SDLReallyCaptureInput(true);
- if (event.key.keysym.unicode)
- {
- handleUnicodeUTF16(event.key.keysym.unicode,
- gKeyboard->currentMask(false));
- }
break;
case SDL_KEYUP:
- mKeyScanCode = event.key.keysym.scancode;
- mKeyVirtualKey = event.key.keysym.unicode;
- mKeyModifiers = event.key.keysym.mod;
+ mKeyVirtualKey = event.key.keysym.sym;
+ mKeyModifiers = event.key.keysym.mod;
+ mInputType = "keyup";
- if (SDLCheckGrabbyKeys(event.key.keysym.sym, false) == 0)
- SDLReallyCaptureInput(false); // part of the fix for SL-13243
+ // treat all possible Enter/Return keys the same
+ if (mKeyVirtualKey == SDLK_RETURN2 || mKeyVirtualKey == SDLK_KP_ENTER)
+ {
+ mKeyVirtualKey = SDLK_RETURN;
+ }
- gKeyboard->handleKeyUp(event.key.keysym.sym, event.key.keysym.mod);
- break;
+ if (SDLCheckGrabbyKeys(mKeyVirtualKey, false) == 0)
+ SDLReallyCaptureInput(false); // part of the fix for SL-13243
+
+ gKeyboard->handleKeyUp(mKeyVirtualKey,mKeyModifiers);
+ break;
case SDL_MOUSEBUTTONDOWN:
{
@@ -1787,7 +1851,7 @@ void LLWindowSDL::gatherInput()
LLCoordWindow winCoord(event.button.x, event.button.y);
LLCoordGL openGlCoord;
convertCoords(winCoord, &openGlCoord);
- MASK mask = gKeyboard->currentMask(true);
+ MASK mask = gKeyboard->currentMask(true);
if (event.button.button == SDL_BUTTON_LEFT) // SDL doesn't manage double clicking...
{
@@ -1799,7 +1863,7 @@ void LLWindowSDL::gatherInput()
if (++leftClick >= 2)
{
leftClick = 0;
- isDoubleClick = true;
+ isDoubleClick = true;
}
}
lastLeftDown = now;
@@ -1830,7 +1894,7 @@ void LLWindowSDL::gatherInput()
else if (event.button.button == SDL_BUTTON_RIGHT) // right
{
- mCallbacks->handleRightMouseDown(this, openGlCoord, mask);
+ mCallbacks->handleRightMouseDown(this, openGlCoord, mask);
}
else if (event.button.button == SDL_BUTTON_MIDDLE) // middle
@@ -1850,86 +1914,69 @@ void LLWindowSDL::gatherInput()
LLCoordWindow winCoord(event.button.x, event.button.y);
LLCoordGL openGlCoord;
convertCoords(winCoord, &openGlCoord);
- MASK mask = gKeyboard->currentMask(true);
+ MASK mask = gKeyboard->currentMask(true);
if (event.button.button == SDL_BUTTON_LEFT) // left
- mCallbacks->handleMouseUp(this, openGlCoord, mask);
+ mCallbacks->handleMouseUp(this, openGlCoord, mask);
else if (event.button.button == SDL_BUTTON_RIGHT) // right
- mCallbacks->handleRightMouseUp(this, openGlCoord, mask);
+ mCallbacks->handleRightMouseUp(this, openGlCoord, mask);
else if (event.button.button == SDL_BUTTON_MIDDLE) // middle
- mCallbacks->handleMiddleMouseUp(this, openGlCoord, mask);
+ mCallbacks->handleMiddleMouseUp(this, openGlCoord, mask);
// don't handle mousewheel here...
break;
}
- case SDL_VIDEOEXPOSE: // VIDEOEXPOSE doesn't specify the damage, but hey, it's OpenGL...repaint the whole thing!
- mCallbacks->handlePaint(this, 0, 0, mWindow->w, mWindow->h);
- break;
-
- case SDL_VIDEORESIZE: // *FIX: handle this?
+ case SDL_WINDOWEVENT: // *FIX: handle this?
{
- LL_INFOS() << "Handling a resize event: " << event.resize.w <<
- "x" << event.resize.h << LL_ENDL;
+ if( event.window.event == SDL_WINDOWEVENT_RESIZED
+ /* || event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED*/ ) // <FS:ND> SDL_WINDOWEVENT_SIZE_CHANGED is followed by SDL_WINDOWEVENT_RESIZED, so handling one shall be enough
+ {
+ LL_INFOS() << "Handling a resize event: " << event.window.data1 << "x" << event.window.data2 << LL_ENDL;
- S32 width = llmax(event.resize.w, (S32)mMinWindowWidth);
- S32 height = llmax(event.resize.h, (S32)mMinWindowHeight);
+ S32 width = llmax(event.window.data1, (S32)mMinWindowWidth);
+ S32 height = llmax(event.window.data2, (S32)mMinWindowHeight);
+ mSurface = SDL_GetWindowSurface( mWindow );
- // *FIX: I'm not sure this is necessary!
- mWindow = SDL_SetVideoMode(width, height, 32, mSDLFlags);
- if (!mWindow)
- {
- // *FIX: More informative dialog?
- LL_INFOS() << "Could not recreate context after resize! Quitting..." << LL_ENDL;
- if(mCallbacks->handleCloseRequest(this))
- {
- // Get the app to initiate cleanup.
- mCallbacks->handleQuit(this);
- // The app is responsible for calling destroyWindow when done with GL
- }
- break;
- }
+ // *FIX: I'm not sure this is necessary!
+ // <FS:ND> I think is is not
+ // SDL_SetWindowSize(mWindow, width, height);
+ //
- mCallbacks->handleResize(this, width, height);
- break;
- }
- case SDL_ACTIVEEVENT:
- if (event.active.state & SDL_APPINPUTFOCUS)
+ mCallbacks->handleResize(this, width, height);
+ }
+ else if( event.window.event == SDL_WINDOWEVENT_FOCUS_GAINED ) // <FS:ND> What about SDL_WINDOWEVENT_ENTER (mouse focus)
{
- // Note that for SDL (particularly on X11), keyboard
- // and mouse focus are independent things. Here we are
- // tracking keyboard focus state changes.
-
- // We have to do our own state massaging because SDL
- // can send us two unfocus events in a row for example,
- // which confuses the focus code [SL-24071].
- if (event.active.gain != mHaveInputFocus)
- {
- mHaveInputFocus = !!event.active.gain;
+ // We have to do our own state massaging because SDL
+ // can send us two unfocus events in a row for example,
+ // which confuses the focus code [SL-24071].
+ mHaveInputFocus = true;
- if (mHaveInputFocus)
mCallbacks->handleFocus(this);
- else
+ }
+ else if( event.window.event == SDL_WINDOWEVENT_FOCUS_LOST ) // <FS:ND> What about SDL_WINDOWEVENT_LEAVE (mouse focus)
+ {
+ // We have to do our own state massaging because SDL
+ // can send us two unfocus events in a row for example,
+ // which confuses the focus code [SL-24071].
+ mHaveInputFocus = false;
+
mCallbacks->handleFocusLost(this);
- }
}
- if (event.active.state & SDL_APPACTIVE)
+ else if( event.window.event == SDL_WINDOWEVENT_MINIMIZED ||
+ event.window.event == SDL_WINDOWEVENT_MAXIMIZED ||
+ event.window.event == SDL_WINDOWEVENT_RESTORED ||
+ event.window.event == SDL_WINDOWEVENT_EXPOSED ||
+ event.window.event == SDL_WINDOWEVENT_SHOWN )
{
- // Change in iconification/minimization state.
- if ((!event.active.gain) != mIsMinimized)
- {
- mIsMinimized = (!event.active.gain);
+ mIsMinimized = (event.window.event == SDL_WINDOWEVENT_MINIMIZED);
- mCallbacks->handleActivate(this, !mIsMinimized);
- LL_INFOS() << "SDL deiconification state switched to " << bool(event.active.gain) << LL_ENDL;
- }
- else
- {
- LL_INFOS() << "Ignored bogus redundant SDL deiconification state switch to " << bool(event.active.gain) << LL_ENDL;
- }
+ mCallbacks->handleActivate(this, !mIsMinimized);
+ LL_INFOS() << "SDL deiconification state switched to " << mIsMinimized << LL_ENDL;
}
- break;
+ break;
+ }
case SDL_QUIT:
if(mCallbacks->handleCloseRequest(this))
{
@@ -1938,9 +1985,9 @@ void LLWindowSDL::gatherInput()
// The app is responsible for calling destroyWindow when done with GL
}
break;
- default:
- //LL_INFOS() << "Unhandled SDL event type " << event.type << LL_ENDL;
- break;
+ default:
+ //LL_INFOS() << "Unhandled SDL event type " << event.type << LL_ENDL;
+ break;
}
}
@@ -1968,21 +2015,21 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty
{
SDL_Surface *cursurface;
LL_DEBUGS() << "Loaded cursor file " << filename << " "
- << bmpsurface->w << "x" << bmpsurface->h << LL_ENDL;
+ << bmpsurface->w << "x" << bmpsurface->h << LL_ENDL;
cursurface = SDL_CreateRGBSurface (SDL_SWSURFACE,
- bmpsurface->w,
- bmpsurface->h,
- 32,
- SDL_SwapLE32(0xFFU),
- SDL_SwapLE32(0xFF00U),
- SDL_SwapLE32(0xFF0000U),
- SDL_SwapLE32(0xFF000000U));
+ bmpsurface->w,
+ bmpsurface->h,
+ 32,
+ SDL_SwapLE32(0xFFU),
+ SDL_SwapLE32(0xFF00U),
+ SDL_SwapLE32(0xFF0000U),
+ SDL_SwapLE32(0xFF000000U));
SDL_FillRect(cursurface, NULL, SDL_SwapLE32(0x00000000U));
// Blit the cursor pixel data onto a 32-bit RGBA surface so we
// only have to cope with processing one type of pixel format.
if (0 == SDL_BlitSurface(bmpsurface, NULL,
- cursurface, NULL))
+ cursurface, NULL))
{
// n.b. we already checked that width is a multiple of 8.
const int bitmap_bytes = (cursurface->w * cursurface->h) / 8;
@@ -1997,26 +2044,26 @@ static SDL_Cursor *makeSDLCursorFromBMP(const char *filename, int hotx, int hoty
for (i=0; i<cursurface->h; ++i) {
for (j=0; j<cursurface->w; ++j) {
U8 *pixelp =
- ((U8*)cursurface->pixels)
- + cursurface->pitch * i
- + j*cursurface->format->BytesPerPixel;
+ ((U8*)cursurface->pixels)
+ + cursurface->pitch * i
+ + j*cursurface->format->BytesPerPixel;
U8 srcred = pixelp[0];
U8 srcgreen = pixelp[1];
U8 srcblue = pixelp[2];
bool mask_bit = (srcred != 200)
- || (srcgreen != 200)
- || (srcblue != 200);
+ || (srcgreen != 200)
+ || (srcblue != 200);
bool data_bit = mask_bit && (srcgreen <= 80);//not 0x80
unsigned char bit_offset = (cursurface->w/8) * i
- + j/8;
+ + j/8;
cursor_data[bit_offset] |= (data_bit) << (7 - (j&7));
cursor_mask[bit_offset] |= (mask_bit) << (7 - (j&7));
}
}
sdlcursor = SDL_CreateCursor((Uint8*)cursor_data,
- (Uint8*)cursor_mask,
- cursurface->w, cursurface->h,
- hotx, hoty);
+ (Uint8*)cursor_mask,
+ cursurface->w, cursurface->h,
+ hotx, hoty);
delete[] cursor_data;
delete[] cursor_mask;
} else {
@@ -2207,8 +2254,6 @@ void LLWindowSDL::hideCursorUntilMouseMove()
}
}
-
-
//
// LLSplashScreenSDL - I don't think we'll bother to implement this; it's
// fairly obsolete at this point.
@@ -2233,133 +2278,51 @@ void LLSplashScreenSDL::hideImpl()
{
}
-
-
-#if LL_GTK
-static void response_callback (GtkDialog *dialog,
- gint arg1,
- gpointer user_data)
-{
- gint *response = (gint*)user_data;
- *response = arg1;
- gtk_widget_destroy(GTK_WIDGET(dialog));
- gtk_main_quit();
-}
-
S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type)
{
- S32 rtn = OSBTN_CANCEL;
-
- if(gWindowImplementation != NULL)
- gWindowImplementation->beforeDialog();
+ SDL_MessageBoxData oData = { SDL_MESSAGEBOX_INFORMATION, nullptr, caption.c_str(), text.c_str(), 0, nullptr, nullptr };
+ SDL_MessageBoxButtonData btnOk[] = {{SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, OSBTN_OK, "OK" }};
+ SDL_MessageBoxButtonData btnOkCancel [] = {{SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, OSBTN_OK, "OK" }, {SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, OSBTN_CANCEL, "Cancel"} };
+ SDL_MessageBoxButtonData btnYesNo[] = { {SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, OSBTN_YES, "Yes" }, {SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT, OSBTN_NO, "No"} };
- if (LLWindowSDL::ll_try_gtk_init())
+ switch (type)
{
- GtkWidget *win = NULL;
-
- LL_INFOS() << "Creating a dialog because we're in windowed mode and GTK is happy." << LL_ENDL;
-
- GtkDialogFlags flags = GTK_DIALOG_MODAL;
- GtkMessageType messagetype;
- GtkButtonsType buttons;
- switch (type)
- {
default:
case OSMB_OK:
- messagetype = GTK_MESSAGE_WARNING;
- buttons = GTK_BUTTONS_OK;
+ oData.flags = SDL_MESSAGEBOX_WARNING;
+ oData.buttons = btnOk;
+ oData.numbuttons = 1;
break;
case OSMB_OKCANCEL:
- messagetype = GTK_MESSAGE_QUESTION;
- buttons = GTK_BUTTONS_OK_CANCEL;
+ oData.flags = SDL_MESSAGEBOX_INFORMATION;
+ oData.buttons = btnOkCancel;
+ oData.numbuttons = 2;
break;
case OSMB_YESNO:
- messagetype = GTK_MESSAGE_QUESTION;
- buttons = GTK_BUTTONS_YES_NO;
+ oData.flags = SDL_MESSAGEBOX_INFORMATION;
+ oData.buttons = btnYesNo;
+ oData.numbuttons = 2;
break;
- }
- win = gtk_message_dialog_new(NULL, flags, messagetype, buttons, "%s",
- text.c_str());
-
-# if LL_X11
- // Make GTK tell the window manager to associate this
- // dialog with our non-GTK SDL window, which should try
- // to keep it on top etc.
- if (gWindowImplementation &&
- gWindowImplementation->mSDL_XWindowID != None)
- {
- gtk_widget_realize(GTK_WIDGET(win)); // so we can get its gdkwin
- GdkWindow *gdkwin = gdk_window_foreign_new(gWindowImplementation->mSDL_XWindowID);
- gdk_window_set_transient_for(GTK_WIDGET(win)->window,
- gdkwin);
- }
-# endif //LL_X11
-
- gtk_window_set_position(GTK_WINDOW(win),
- GTK_WIN_POS_CENTER_ON_PARENT);
-
- gtk_window_set_type_hint(GTK_WINDOW(win),
- GDK_WINDOW_TYPE_HINT_DIALOG);
-
- if (!caption.empty())
- gtk_window_set_title(GTK_WINDOW(win), caption.c_str());
-
- gint response = GTK_RESPONSE_NONE;
- g_signal_connect (win,
- "response",
- G_CALLBACK (response_callback),
- &response);
-
- // we should be able to use a gtk_dialog_run(), but it's
- // apparently not written to exist in a world without a higher
- // gtk_main(), so we manage its signal/destruction outselves.
- gtk_widget_show_all (win);
- gtk_main();
-
- //LL_INFOS() << "response: " << response << LL_ENDL;
- switch (response)
- {
- case GTK_RESPONSE_OK: rtn = OSBTN_OK; break;
- case GTK_RESPONSE_YES: rtn = OSBTN_YES; break;
- case GTK_RESPONSE_NO: rtn = OSBTN_NO; break;
- case GTK_RESPONSE_APPLY: rtn = OSBTN_OK; break;
- case GTK_RESPONSE_NONE:
- case GTK_RESPONSE_CANCEL:
- case GTK_RESPONSE_CLOSE:
- case GTK_RESPONSE_DELETE_EVENT:
- default: rtn = OSBTN_CANCEL;
- }
}
- else
- {
- LL_INFOS() << "MSGBOX: " << caption << ": " << text << LL_ENDL;
- LL_INFOS() << "Skipping dialog because we're in fullscreen mode or GTK is not happy." << LL_ENDL;
- rtn = OSBTN_OK;
- }
-
- if(gWindowImplementation != NULL)
- gWindowImplementation->afterDialog();
- return rtn;
+ int btn{0};
+ if( 0 == SDL_ShowMessageBox( &oData, &btn ) )
+ return btn;
+ return OSBTN_CANCEL;
}
-static void color_changed_callback(GtkWidget *widget,
- gpointer user_data)
+bool LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)
{
- GtkColorSelection *colorsel = GTK_COLOR_SELECTION(widget);
- GdkColor *colorp = (GdkColor*)user_data;
-
- gtk_color_selection_get_current_color(colorsel, colorp);
+ return (false);
}
-
/*
Make the raw keyboard data available - used to poke through to LLQtWebKit so
that Qt/Webkit has access to the virtual keycodes etc. that it needs
*/
LLSD LLWindowSDL::getNativeKeyData()
{
- LLSD result = LLSD::emptyMap();
+ LLSD result = LLSD::emptyMap();
U32 modifiers = 0; // pretend-native modifiers... oh what a tangled web we weave!
@@ -2377,99 +2340,14 @@ LLSD LLWindowSDL::getNativeKeyData()
// *todo: test ALTs - I don't have a case for testing these. Do you?
// *todo: NUM? - I don't care enough right now (and it's not a GDK modifier).
- result["scan_code"] = (S32)mKeyScanCode;
- result["virtual_key"] = (S32)mKeyVirtualKey;
+ result["virtual_key"] = (S32)mKeyVirtualKey;
+ result["virtual_key_win"] = (S32)LLKeyboardSDL::mapSDL2toWin( mKeyVirtualKey );
result["modifiers"] = (S32)modifiers;
-
- return result;
-}
-
-
-bool LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)
-{
- bool rtn = false;
-
- beforeDialog();
-
- if (ll_try_gtk_init())
- {
- GtkWidget *win = NULL;
-
- win = gtk_color_selection_dialog_new(NULL);
-
-# if LL_X11
- // Get GTK to tell the window manager to associate this
- // dialog with our non-GTK SDL window, which should try
- // to keep it on top etc.
- if (mSDL_XWindowID != None)
- {
- gtk_widget_realize(GTK_WIDGET(win)); // so we can get its gdkwin
- GdkWindow *gdkwin = gdk_window_foreign_new(mSDL_XWindowID);
- gdk_window_set_transient_for(GTK_WIDGET(win)->window,
- gdkwin);
- }
-# endif //LL_X11
-
- GtkColorSelection *colorsel = GTK_COLOR_SELECTION (GTK_COLOR_SELECTION_DIALOG(win)->colorsel);
-
- GdkColor color, orig_color;
- orig_color.pixel = 0;
- orig_color.red = guint16(65535 * *r);
- orig_color.green= guint16(65535 * *g);
- orig_color.blue = guint16(65535 * *b);
- color = orig_color;
-
- gtk_color_selection_set_previous_color (colorsel, &color);
- gtk_color_selection_set_current_color (colorsel, &color);
- gtk_color_selection_set_has_palette (colorsel, true);
- gtk_color_selection_set_has_opacity_control(colorsel, false);
-
- gint response = GTK_RESPONSE_NONE;
- g_signal_connect (win,
- "response",
- G_CALLBACK (response_callback),
- &response);
-
- g_signal_connect (G_OBJECT (colorsel), "color_changed",
- G_CALLBACK (color_changed_callback),
- &color);
-
- gtk_window_set_modal(GTK_WINDOW(win), true);
- gtk_widget_show_all(win);
- // hide the help button - we don't service it.
- gtk_widget_hide(GTK_COLOR_SELECTION_DIALOG(win)->help_button);
- gtk_main();
-
- if (response == GTK_RESPONSE_OK &&
- (orig_color.red != color.red
- || orig_color.green != color.green
- || orig_color.blue != color.blue) )
- {
- *r = color.red / 65535.0f;
- *g = color.green / 65535.0f;
- *b = color.blue / 65535.0f;
- rtn = true;
- }
- }
-
- afterDialog();
-
- return rtn;
-}
-#else
-S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type)
-{
- LL_INFOS() << "MSGBOX: " << caption << ": " << text << LL_ENDL;
- return 0;
-}
-
-bool LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b)
-{
- return (false);
+ result["input_type"] = mInputType;
+ return result;
}
-#endif // LL_GTK
-#if LL_LINUX
+#if LL_LINUX || LL_SOLARIS
// extracted from spawnWebBrowser for clarity and to eliminate
// compiler confusion regarding close(int fd) vs. LLWindow::close()
void exec_cmd(const std::string& cmd, const std::string& arg)
@@ -2481,9 +2359,32 @@ void exec_cmd(const std::string& cmd, const std::string& arg)
{ // child
// disconnect from stdin/stdout/stderr, or child will
// keep our output pipe undesirably alive if it outlives us.
- close(0);
- close(1);
- close(2);
+ // close(0);
+ // close(1);
+ // close(2);
+ // <FS:TS> Reopen stdin, stdout, and stderr to /dev/null.
+ // It's good practice to always have those file
+ // descriptors open to something, lest the exec'd
+ // program actually try to use them.
+ FILE *result;
+ result = freopen("/dev/null","r",stdin);
+ if (result == NULL)
+ {
+ LL_WARNS() << "Error reopening stdin for web browser: "
+ << strerror(errno) << LL_ENDL;
+ }
+ result = freopen("/dev/null","w",stdout);
+ if (result == NULL)
+ {
+ LL_WARNS() << "Error reopening stdout for web browser: "
+ << strerror(errno) << LL_ENDL;
+ }
+ result = freopen("/dev/null","w",stderr);
+ if (result == NULL)
+ {
+ LL_WARNS() << "Error reopening stderr for web browser: "
+ << strerror(errno) << LL_ENDL;
+ }
// end ourself by running the command
execv(cmd.c_str(), argv); /* Flawfinder: ignore */
// if execv returns at all, there was a problem.
@@ -2549,31 +2450,13 @@ void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)
LL_INFOS() << "spawn_web_browser returning." << LL_ENDL;
}
+void LLWindowSDL::openFile(const std::string& file_name)
+{
+ spawnWebBrowser("file://"+file_name,true);
+}
void *LLWindowSDL::getPlatformWindow()
{
-#if LL_GTK && LL_LLMOZLIB_ENABLED
- if (LLWindowSDL::ll_try_gtk_init())
- {
- maybe_lock_display();
-
- GtkWidget *owin = gtk_window_new(GTK_WINDOW_POPUP);
- // Why a layout widget? A MozContainer would be ideal, but
- // it involves exposing Mozilla headers to mozlib-using apps.
- // A layout widget with a GtkWindow parent has the desired
- // properties of being plain GTK, having a window, and being
- // derived from a GtkContainer.
- GtkWidget *rtnw = gtk_layout_new(NULL, NULL);
- gtk_container_add(GTK_CONTAINER(owin), rtnw);
- gtk_widget_realize(rtnw);
- GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(rtnw), GTK_NO_WINDOW);
-
- maybe_unlock_display();
-
- return rtnw;
- }
-#endif // LL_GTK && LL_LLMOZLIB_ENABLED
- // Unixoid mozilla really needs GTK.
return NULL;
}
@@ -2634,10 +2517,10 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
LL_INFOS("AppInit") << "Variant " << locale->variant << LL_ENDL;
LL_INFOS() << "Preferring fonts of language: "
- << locale->lang
- << LL_ENDL;
+ << locale->lang
+ << LL_ENDL;
sort_order = "lang=" + std::string(locale->lang) + ":"
- + sort_order;
+ + sort_order;
}
}
FL_FreeLocale(&locale);
@@ -2655,7 +2538,7 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
// Sort the list of system fonts from most-to-least-desirable.
FcResult result;
fs = FcFontSort(NULL, sortpat, elide_unicode_coverage,
- NULL, &result);
+ NULL, &result);
FcPatternDestroy(sortpat);
}
@@ -2669,8 +2552,8 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
{
FcChar8 *filename;
if (FcResultMatch == FcPatternGetString(fs->fonts[i],
- FC_FILE, 0,
- &filename)
+ FC_FILE, 0,
+ &filename)
&& filename)
{
rtns.push_back(std::string((const char*)filename));
@@ -2694,4 +2577,54 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
return rtns;
}
-#endif // LL_SDL
+
+void* LLWindowSDL::createSharedContext()
+{
+ auto *pContext = SDL_GL_CreateContext(mWindow);
+ if ( pContext)
+ {
+ SDL_GL_SetSwapInterval(0);
+ SDL_GL_MakeCurrent(mWindow, mContext);
+
+ LLCoordScreen size;
+ if (getSize(&size))
+ setSize(size);
+
+ LL_DEBUGS() << "Creating shared OpenGL context successful!" << LL_ENDL;
+
+ return (void*)pContext;
+ }
+
+ LL_WARNS() << "Creating shared OpenGL context failed!" << LL_ENDL;
+
+ return nullptr;
+}
+
+void LLWindowSDL::makeContextCurrent(void* contextPtr)
+{
+ LL_PROFILER_GPU_CONTEXT;
+ SDL_GL_MakeCurrent( mWindow, contextPtr );
+}
+
+void LLWindowSDL::destroySharedContext(void* contextPtr)
+{
+ SDL_GL_DeleteContext( contextPtr );
+}
+
+void LLWindowSDL::toggleVSync(bool enable_vsync)
+{
+}
+
+void LLWindowSDL::setLanguageTextInput(const LLCoordGL& position)
+{
+ LLCoordWindow win_pos;
+ convertCoords( position, &win_pos );
+
+ SDL_Rect r;
+ r.x = win_pos.mX;
+ r.y = win_pos.mY;
+ r.w = 500;
+ r.h = 16;
+
+ SDL_SetTextInputRect(&r);
+}
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index 196ad2986d..10769bb3ba 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -24,20 +24,20 @@
* $/LicenseInfo$
*/
-#ifndef LL_LLWINDOWSDL_H
-#define LL_LLWINDOWSDL_H
+#ifndef LL_LLWINDOWSDL2_H
+#define LL_LLWINDOWSDL2_H
// Simple Directmedia Layer (http://libsdl.org/) implementation of LLWindow class
#include "llwindow.h"
#include "lltimer.h"
-#include "SDL/SDL.h"
-#include "SDL/SDL_endian.h"
+#include "SDL2/SDL.h"
+#include "SDL2/SDL_endian.h"
#if LL_X11
// get X11-specific headers for use in low-level stuff like copy-and-paste support
-#include "SDL/SDL_syswm.h"
+#include "SDL2/SDL_syswm.h"
#endif
// AssertMacros.h does bad things.
@@ -46,83 +46,139 @@
#undef require
-class LLWindowSDL : public LLWindow
-{
+class LLWindowSDL : public LLWindow {
public:
- /*virtual*/ void show();
- /*virtual*/ void hide();
- /*virtual*/ void close();
- /*virtual*/ bool getVisible();
- /*virtual*/ bool getMinimized();
- /*virtual*/ bool getMaximized();
- /*virtual*/ bool maximize();
- /*virtual*/ void minimize();
- /*virtual*/ void restore();
- /*virtual*/ bool getFullscreen();
- /*virtual*/ bool getPosition(LLCoordScreen *position);
- /*virtual*/ bool getSize(LLCoordScreen *size);
- /*virtual*/ bool getSize(LLCoordWindow *size);
- /*virtual*/ bool setPosition(LLCoordScreen position);
- /*virtual*/ bool setSizeImpl(LLCoordScreen size);
- /*virtual*/ bool setSizeImpl(LLCoordWindow size);
- /*virtual*/ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool disable_vsync, const LLCoordScreen * const posp = NULL);
- /*virtual*/ bool setCursorPosition(LLCoordWindow position);
- /*virtual*/ bool getCursorPosition(LLCoordWindow *position);
- /*virtual*/ void showCursor();
- /*virtual*/ void hideCursor();
- /*virtual*/ void showCursorFromMouseMove();
- /*virtual*/ void hideCursorUntilMouseMove();
- /*virtual*/ bool isCursorHidden();
- /*virtual*/ void updateCursor();
- /*virtual*/ void captureMouse();
- /*virtual*/ void releaseMouse();
- /*virtual*/ void setMouseClipping( bool b );
- /*virtual*/ void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true);
-
- /*virtual*/ bool isClipboardTextAvailable();
- /*virtual*/ bool pasteTextFromClipboard(LLWString &dst);
- /*virtual*/ bool copyTextToClipboard(const LLWString & src);
-
- /*virtual*/ bool isPrimaryTextAvailable();
- /*virtual*/ bool pasteTextFromPrimary(LLWString &dst);
- /*virtual*/ bool copyTextToPrimary(const LLWString & src);
-
- /*virtual*/ void flashIcon(F32 seconds);
- /*virtual*/ F32 getGamma();
- /*virtual*/ bool setGamma(const F32 gamma); // Set the gamma
- /*virtual*/ U32 getFSAASamples();
- /*virtual*/ void setFSAASamples(const U32 samples);
- /*virtual*/ bool restoreGamma(); // Restore original gamma table (before updating gamma)
- /*virtual*/ ESwapMethod getSwapMethod() { return mSwapMethod; }
- /*virtual*/ void processMiscNativeEvents();
- /*virtual*/ void gatherInput();
- /*virtual*/ void swapBuffers();
- /*virtual*/ void restoreGLContext() {};
-
- /*virtual*/ void delayInputProcessing() { };
+ void show() override;
+
+ void hide() override;
+
+ void close() override;
+
+ bool getVisible() override;
+
+ bool getMinimized() override;
+
+ bool getMaximized() override;
+
+ bool maximize() override;
+
+ void minimize() override;
+
+ void restore() override;
+
+ bool getFullscreen();
+
+ bool getPosition(LLCoordScreen *position) override;
+
+ bool getSize(LLCoordScreen *size) override;
+
+ bool getSize(LLCoordWindow *size) override;
+
+ bool setPosition(LLCoordScreen position) override;
+
+ bool setSizeImpl(LLCoordScreen size) override;
+
+ bool setSizeImpl(LLCoordWindow size) override;
+
+ bool switchContext(bool fullscreen, const LLCoordScreen &size, bool enable_vsync,
+ const LLCoordScreen *const posp = NULL) override;
+
+ bool setCursorPosition(LLCoordWindow position) override;
+
+ bool getCursorPosition(LLCoordWindow *position) override;
+
+ void showCursor() override;
+
+ void hideCursor() override;
+
+ void showCursorFromMouseMove() override;
+
+ void hideCursorUntilMouseMove() override;
+
+ bool isCursorHidden() override;
+
+ void updateCursor() override;
+
+ void captureMouse() override;
+
+ void releaseMouse() override;
+
+ void setMouseClipping(bool b) override;
+
+ void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true) override;
+
+ bool isClipboardTextAvailable() override;
+
+ bool pasteTextFromClipboard(LLWString &dst) override;
+
+ bool copyTextToClipboard(const LLWString &src) override;
+
+ bool isPrimaryTextAvailable() override;
+
+ bool pasteTextFromPrimary(LLWString &dst) override;
+
+ bool copyTextToPrimary(const LLWString &src) override;
+
+ void flashIcon(F32 seconds) override;
+
+ F32 getGamma() override;
+
+ bool setGamma(const F32 gamma) override; // Set the gamma
+ U32 getFSAASamples() override;
+
+ void setFSAASamples(const U32 samples) override;
+
+ bool restoreGamma() override; // Restore original gamma table (before updating gamma)
+ ESwapMethod getSwapMethod() override { return mSwapMethod; }
+
+ void processMiscNativeEvents() override;
+
+ void gatherInput() override;
+
+ void swapBuffers() override;
+
+ void restoreGLContext() {};
+
+ void delayInputProcessing() override {};
// handy coordinate space conversion routines
- /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordWindow *to);
- /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordScreen *to);
- /*virtual*/ bool convertCoords(LLCoordWindow from, LLCoordGL *to);
- /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordWindow *to);
- /*virtual*/ bool convertCoords(LLCoordScreen from, LLCoordGL *to);
- /*virtual*/ bool convertCoords(LLCoordGL from, LLCoordScreen *to);
+ bool convertCoords(LLCoordScreen from, LLCoordWindow *to) override;
+
+ bool convertCoords(LLCoordWindow from, LLCoordScreen *to) override;
+
+ bool convertCoords(LLCoordWindow from, LLCoordGL *to) override;
+
+ bool convertCoords(LLCoordGL from, LLCoordWindow *to) override;
+
+ bool convertCoords(LLCoordScreen from, LLCoordGL *to) override;
- /*virtual*/ LLWindowResolution* getSupportedResolutions(S32 &num_resolutions);
- /*virtual*/ F32 getNativeAspectRatio();
- /*virtual*/ F32 getPixelAspectRatio();
- /*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; }
+ bool convertCoords(LLCoordGL from, LLCoordScreen *to) override;
- /*virtual*/ void beforeDialog();
- /*virtual*/ void afterDialog();
+ LLWindowResolution *getSupportedResolutions(S32 &num_resolutions) override;
- /*virtual*/ bool dialogColorPicker(F32 *r, F32 *g, F32 *b);
+ F32 getNativeAspectRatio() override;
- /*virtual*/ void *getPlatformWindow();
- /*virtual*/ void bringToFront();
+ F32 getPixelAspectRatio() override;
- /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
+ void setNativeAspectRatio(F32 ratio) override { mOverrideAspectRatio = ratio; }
+
+ void beforeDialog() override;
+
+ void afterDialog() override;
+
+ bool dialogColorPicker(F32 *r, F32 *g, F32 *b) override;
+
+ void *getPlatformWindow() override;
+
+ void bringToFront() override;
+
+ void setLanguageTextInput(const LLCoordGL& pos) override;
+
+ void spawnWebBrowser(const std::string &escaped_url, bool async) override;
+
+ void openFile(const std::string &file_name);
+
+ void setTitle(const std::string title) override;
static std::vector<std::string> getDynamicFallbackFontList();
@@ -132,40 +188,52 @@ public:
Window mSDL_XWindowID;
Display *mSDL_Display;
#endif
+
void (*Lock_Display)(void);
- void (*Unlock_Display)(void);
-#if LL_GTK
- // Lazily initialize and check the runtime GTK version for goodness.
- static bool ll_try_gtk_init(void);
-#endif // LL_GTK
+ void (*Unlock_Display)(void);
#if LL_X11
+
static Window get_SDL_XWindowID(void);
- static Display* get_SDL_Display(void);
+
+ static Display *get_SDL_Display(void);
+
#endif // LL_X11
+ void *createSharedContext() override;
+
+ void makeContextCurrent(void *context) override;
+
+ void destroySharedContext(void *context) override;
+
+ void toggleVSync(bool enable_vsync) override;
+
protected:
- LLWindowSDL(LLWindowCallbacks* callbacks,
- const std::string& title, int x, int y, int width, int height, U32 flags,
- bool fullscreen, bool clearBg, bool disable_vsync, bool use_gl,
- bool ignore_pixel_depth, U32 fsaa_samples);
+ LLWindowSDL(LLWindowCallbacks *callbacks,
+ const std::string &title, int x, int y, int width, int height, U32 flags,
+ bool fullscreen, bool clearBg, bool enable_vsync, bool use_gl,
+ bool ignore_pixel_depth, U32 fsaa_samples);
+
~LLWindowSDL();
- /*virtual*/ bool isValid();
- /*virtual*/ LLSD getNativeKeyData();
+ bool isValid() override;
+
+ LLSD getNativeKeyData() override;
+
+ void initCursors();
- void initCursors();
- void quitCursors();
- void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
+ void quitCursors();
+
+ void moveWindow(const LLCoordScreen &position, const LLCoordScreen &size);
// Changes display resolution. Returns true if successful
- bool setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh);
+ bool setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh);
// Go back to last fullscreen display resolution.
- bool setFullscreenResolution();
+ bool setFullscreenResolution();
- bool shouldPostQuit() { return mPostQuit; }
+ bool shouldPostQuit() { return mPostQuit; }
protected:
//
@@ -173,47 +241,85 @@ protected:
//
// create or re-create the GL context/window. Called from the constructor and switchContext().
- bool createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool disable_vsync);
+ bool createContext(int x, int y, int width, int height, int bits, bool fullscreen, bool enable_vsync);
+
void destroyContext();
- void setupFailure(const std::string& text, const std::string& caption, U32 type);
+
+ void setupFailure(const std::string &text, const std::string &caption, U32 type);
+
void fixWindowSize(void);
- U32 SDLCheckGrabbyKeys(SDLKey keysym, bool gain);
+
+ U32 SDLCheckGrabbyKeys(U32 keysym, bool gain);
+
bool SDLReallyCaptureInput(bool capture);
//
// Platform specific variables
//
- U32 mGrabbyKeyFlags;
- int mReallyCapturedCount;
- SDL_Surface * mWindow;
+ U32 mGrabbyKeyFlags;
+ int mReallyCapturedCount;
+
+ SDL_Window *mWindow;
+ SDL_Surface *mSurface;
+ SDL_GLContext mContext;
+ SDL_Cursor *mSDLCursors[UI_CURSOR_COUNT];
+
std::string mWindowTitle;
- double mOriginalAspectRatio;
- bool mNeedsResize; // Constructor figured out the window is too big, it needs a resize.
- LLCoordScreen mNeedsResizeSize;
- F32 mOverrideAspectRatio;
- F32 mGamma;
- U32 mFSAASamples;
+ double mOriginalAspectRatio;
+ bool mNeedsResize; // Constructor figured out the window is too big, it needs a resize.
+ LLCoordScreen mNeedsResizeSize;
+ F32 mOverrideAspectRatio;
+ F32 mGamma;
+ U32 mFSAASamples;
- int mSDLFlags;
+ int mSDLFlags;
- SDL_Cursor* mSDLCursors[UI_CURSOR_COUNT];
- int mHaveInputFocus; /* 0=no, 1=yes, else unknown */
- int mIsMinimized; /* 0=no, 1=yes, else unknown */
+ int mHaveInputFocus; /* 0=no, 1=yes, else unknown */
+ int mIsMinimized; /* 0=no, 1=yes, else unknown */
friend class LLWindowManager;
private:
#if LL_X11
+
void x11_set_urgent(bool urgent);
+
bool mFlashing;
LLTimer mFlashTimer;
#endif //LL_X11
- U32 mKeyScanCode;
- U32 mKeyVirtualKey;
- SDLMod mKeyModifiers;
-};
+ U32 mKeyVirtualKey;
+ U32 mKeyModifiers;
+ std::string mInputType;
+
+public:
+#if LL_X11
+
+ static Display *getSDLDisplay();
+ LLWString const &getPrimaryText() const { return mPrimaryClipboard; }
+
+ LLWString const &getSecondaryText() const { return mSecondaryClipboard; }
+
+ void clearPrimaryText() { mPrimaryClipboard.clear(); }
+
+ void clearSecondaryText() { mSecondaryClipboard.clear(); }
+
+private:
+ void tryFindFullscreenSize(int &aWidth, int &aHeight);
+
+ void initialiseX11Clipboard();
+
+ bool getSelectionText(Atom selection, LLWString &text);
+
+ bool getSelectionText(Atom selection, Atom type, LLWString &text);
+
+ bool setSelectionText(Atom selection, const LLWString &text);
+
+#endif
+ LLWString mPrimaryClipboard;
+ LLWString mSecondaryClipboard;
+};
class LLSplashScreenSDL : public LLSplashScreen
{
@@ -221,9 +327,9 @@ public:
LLSplashScreenSDL();
virtual ~LLSplashScreenSDL();
- /*virtual*/ void showImpl();
- /*virtual*/ void updateImpl(const std::string& mesg);
- /*virtual*/ void hideImpl();
+ void showImpl();
+ void updateImpl(const std::string& mesg);
+ void hideImpl();
};
S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 type);
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 01edbb53af..b19fa13b41 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -163,18 +163,7 @@ HGLRC SafeCreateContext(HDC &hdc)
GLuint SafeChoosePixelFormat(HDC &hdc, const PIXELFORMATDESCRIPTOR *ppfd)
{
- __try
- {
- return ChoosePixelFormat(hdc, ppfd);
- }
- __except (EXCEPTION_EXECUTE_HANDLER)
- {
- // convert to C++ styled exception
- // C exception don't allow classes, so it's a regular char array
- char integer_string[32];
- sprintf(integer_string, "SEH, code: %lu\n", GetExceptionCode());
- throw std::exception(integer_string);
- }
+ return LL::seh::catcher([hdc, ppfd]{ return ChoosePixelFormat(hdc, ppfd); });
}
//static
@@ -1630,9 +1619,11 @@ const S32 max_format = (S32)num_formats - 1;
}
else
{
- LLError::LLUserWarningMsg::show(mCallbacks->translateString("MBVideoDrvErr"));
- // mWindowHandle is 0, going to crash either way
- LL_ERRS("Window") << "No wgl_ARB_pixel_format extension!" << LL_ENDL;
+ LL_WARNS("Window") << "No wgl_ARB_pixel_format extension!" << LL_ENDL;
+ // cannot proceed without wgl_ARB_pixel_format extension, shutdown same as any other gGLManager.initGL() failure
+ OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK);
+ close();
+ return false;
}
// Verify what pixel format we actually received.
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index 381f8882ca..e38cfe7ebc 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -28,7 +28,7 @@
#define LL_LLWINDOWWIN32_H
// Limit Windows API to small and manageable set.
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include "llwindow.h"
#include "llwindowcallbacks.h"
diff --git a/indra/llxml/llxmltree.cpp b/indra/llxml/llxmltree.cpp
index 164b3156e1..d66544d0f8 100644
--- a/indra/llxml/llxmltree.cpp
+++ b/indra/llxml/llxmltree.cpp
@@ -108,12 +108,15 @@ LLXmlTreeNode::LLXmlTreeNode( const std::string& name, LLXmlTreeNode* parent, LL
LLXmlTreeNode::~LLXmlTreeNode()
{
- attribute_map_t::iterator iter;
- for (iter=mAttributes.begin(); iter != mAttributes.end(); iter++)
- delete iter->second;
- for(LLXmlTreeNode* node : mChildren)
+ for (auto& attr : mAttributes)
+ {
+ delete attr.second;
+ }
+ mAttributes.clear();
+
+ for (auto& child : mChildren)
{
- delete node;
+ delete child;
}
mChildren.clear();
}
diff --git a/indra/media_plugins/CMakeLists.txt b/indra/media_plugins/CMakeLists.txt
index 972bb7dd2d..86c46cb476 100644
--- a/indra/media_plugins/CMakeLists.txt
+++ b/indra/media_plugins/CMakeLists.txt
@@ -3,8 +3,9 @@
add_subdirectory(base)
if (LINUX)
- #add_subdirectory(gstreamer010)
+ add_subdirectory(cef)
add_subdirectory(example)
+ add_subdirectory(gstreamer10)
endif (LINUX)
if (DARWIN)
diff --git a/indra/media_plugins/base/CMakeLists.txt b/indra/media_plugins/base/CMakeLists.txt
index 64b6a4228d..5e635c6ca3 100644
--- a/indra/media_plugins/base/CMakeLists.txt
+++ b/indra/media_plugins/base/CMakeLists.txt
@@ -12,13 +12,6 @@ include(PluginAPI)
### media_plugin_base
-if(NOT ADDRESS_SIZE EQUAL 32)
- if(WINDOWS)
- ##add_definitions(/FIXED:NO)
- else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
- add_definitions(-fPIC)
- endif(WINDOWS)
-endif(NOT ADDRESS_SIZE EQUAL 32)
set(media_plugin_base_SOURCE_FILES
media_plugin_base.cpp
diff --git a/indra/media_plugins/base/media_plugin_base.cpp b/indra/media_plugins/base/media_plugin_base.cpp
index 545eee25a9..9bb3bad035 100644
--- a/indra/media_plugins/base/media_plugin_base.cpp
+++ b/indra/media_plugins/base/media_plugin_base.cpp
@@ -167,6 +167,56 @@ void MediaPluginBase::sendStatus()
sendMessage(message);
}
+#if LL_LINUX
+
+size_t SymbolGrabber::registerSymbol( SymbolToGrab aSymbol )
+{
+ gSymbolsToGrab.emplace_back(aSymbol);
+ return gSymbolsToGrab.size();
+}
+
+bool SymbolGrabber::grabSymbols(std::vector< std::string > const &aDSONames)
+{
+ std::cerr << "SYMBOLS: " << gSymbolsToGrab.size() << std::endl;
+
+ if (sSymsGrabbed)
+ return true;
+
+ //attempt to load the shared libraries
+ apr_pool_create(&sSymDSOMemoryPool, nullptr);
+
+ for( std::vector< std::string >::const_iterator itr = aDSONames.begin(); itr != aDSONames.end(); ++itr )
+ {
+ apr_dso_handle_t *pDSO(NULL);
+ std::string strDSO{ *itr };
+ if( APR_SUCCESS == apr_dso_load( &pDSO, strDSO.c_str(), sSymDSOMemoryPool ))
+ sLoadedLibraries.push_back( pDSO );
+
+ for( auto i = 0; i < gSymbolsToGrab.size(); ++i )
+ {
+ if( !*gSymbolsToGrab[i].mPPFunc )
+ apr_dso_sym( gSymbolsToGrab[i].mPPFunc, pDSO, gSymbolsToGrab[i].mName );
+ }
+ }
+
+ bool sym_error = false;
+
+ for( auto i = 0; i < gSymbolsToGrab.size(); ++i )
+ {
+ if( gSymbolsToGrab[ i ].mRequired && ! *gSymbolsToGrab[ i ].mPPFunc )
+ sym_error = true;
+ }
+
+ sSymsGrabbed = !sym_error;
+ return sSymsGrabbed;
+}
+
+void SymbolGrabber::ungrabSymbols()
+{
+
+}
+#endif
+
#if LL_WINDOWS
# define LLSYMEXPORT __declspec(dllexport)
@@ -204,3 +254,50 @@ int WINAPI DllEntryPoint( HINSTANCE hInstance, unsigned long reason, void* param
return 1;
}
#endif
+
+#if LL_LINUX
+pid_t getParentPid( pid_t aPid )
+{
+ std::stringstream strm;
+ strm << "/proc/" << aPid << "/status";
+ std::ifstream in{ strm.str() };
+
+ if( !in.is_open() )
+ return 0;
+
+ pid_t res {0};
+ while( !in.eof() && res == 0 )
+ {
+ std::string line;
+ line.resize( 1024, 0 );
+ in.getline( &line[0], line.length() );
+
+ auto i = line.find( "PPid:" );
+
+ if( i == std::string::npos )
+ continue;
+
+ char const *pIn = line.c_str() + 5; // Skip over pid;
+ while( *pIn != 0 && isspace( *pIn ) )
+ ++pIn;
+
+ if( *pIn )
+ res = atoll( pIn );
+ }
+ return res;
+}
+
+bool isPluginPid( pid_t aPid )
+{
+ auto myPid = getpid();
+
+ do
+ {
+ if( aPid == myPid )
+ return true;
+ aPid = getParentPid( aPid );
+ } while( aPid > 1 );
+
+ return false;
+}
+#endif
diff --git a/indra/media_plugins/base/media_plugin_base.h b/indra/media_plugins/base/media_plugin_base.h
index f65c712a66..a084fc9834 100644
--- a/indra/media_plugins/base/media_plugin_base.h
+++ b/indra/media_plugins/base/media_plugin_base.h
@@ -32,6 +32,41 @@
#include "llpluginmessage.h"
#include "llpluginmessageclasses.h"
+#if LL_LINUX
+
+struct SymbolToGrab
+{
+ bool mRequired;
+ char const *mName;
+ apr_dso_handle_sym_t *mPPFunc;
+};
+
+class SymbolGrabber
+{
+public:
+ size_t registerSymbol( SymbolToGrab aSymbol );
+ bool grabSymbols(std::vector< std::string > const &aDSONames);
+ void ungrabSymbols();
+
+private:
+ std::vector< SymbolToGrab > gSymbolsToGrab;
+
+ bool sSymsGrabbed = false;
+ apr_pool_t *sSymDSOMemoryPool = nullptr;
+ std::vector<apr_dso_handle_t *> sLoadedLibraries;
+};
+
+extern SymbolGrabber gSymbolGrabber;
+
+// extern SymbolGrabber gSymbolGrabber;
+
+#define LL_GRAB_SYM(SYMBOL_GRABBER, REQUIRED, SYMBOL_NAME, RETURN, ...) \
+ RETURN (*ll##SYMBOL_NAME)(__VA_ARGS__) = nullptr; \
+ size_t gRegistered##SYMBOL_NAME = SYMBOL_GRABBER.registerSymbol( \
+ { REQUIRED, #SYMBOL_NAME , (apr_dso_handle_sym_t*)&ll##SYMBOL_NAME} \
+ );
+
+#endif
class MediaPluginBase
{
@@ -46,7 +81,6 @@ public:
static void staticReceiveMessage(const char *message_string, void **user_data);
protected:
-
/** Plugin status. */
typedef enum
{
@@ -126,4 +160,7 @@ int init_media_plugin(
LLPluginInstance::sendMessageFunction *plugin_send_func,
void **plugin_user_data);
-
+#if LL_LINUX
+pid_t getParentPid(pid_t aPid);
+bool isPluginPid(pid_t aPid);
+#endif
diff --git a/indra/media_plugins/cef/CMakeLists.txt b/indra/media_plugins/cef/CMakeLists.txt
index 0d1a833936..28e5f64132 100644
--- a/indra/media_plugins/cef/CMakeLists.txt
+++ b/indra/media_plugins/cef/CMakeLists.txt
@@ -10,18 +10,10 @@ include(Linking)
include(PluginAPI)
include(CEFPlugin)
-
+include(GLIB)
### media_plugin_cef
-if(NOT ADDRESS_SIZE EQUAL 32)
- if(WINDOWS)
- ##add_definitions(/FIXED:NO)
- else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
- add_definitions(-fPIC)
- endif(WINDOWS)
-endif(NOT ADDRESS_SIZE EQUAL 32)
-
set(media_plugin_cef_SOURCE_FILES
media_plugin_cef.cpp
)
@@ -32,10 +24,36 @@ set(media_plugin_cef_HEADER_FILES
# Select which VolumeCatcher implementation to use
if (LINUX)
- message(FATAL_ERROR "CEF plugin has been enabled for a Linux compile.\n"
- " Please create a volume_catcher implementation for this platform.")
+ foreach( PULSE_FILE pulse/introspect.h pulse/context.h pulse/subscribe.h pulse/glib-mainloop.h )
+ find_path( PULSE_FILE_${PULSE_FILE}_FOUND ${PULSE_FILE} NO_CACHE)
+ if( NOT PULSE_FILE_${PULSE_FILE}_FOUND )
+ message( "Looking for ${PULSE_FILE} ... not found")
+ message( FATAL_ERROR "Pulse header not found" )
+ else()
+ message( "Looking for ${PULSE_FILE} ... found")
+ endif()
+ endforeach()
+
+ include(FindPipeWire)
+ include_directories(SYSTEM ${PIPEWIRE_INCLUDE_DIRS} ${SPA_INCLUDE_DIRS})
+
+ message( "Building with Linux volume catcher for PipeWire and PulseAudio" )
+
+ list(APPEND media_plugin_cef_HEADER_FILES
+ linux/volume_catcher_linux.h
+ )
+
+ set(LINUX_VOLUME_CATCHER
+ linux/volume_catcher_linux.cpp
+ linux/volume_catcher_pulseaudio.cpp
+ linux/volume_catcher_pipewire.cpp
+ )
+
+ list(APPEND media_plugin_cef_SOURCE_FILES ${LINUX_VOLUME_CATCHER})
+ set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--build-id -Wl,-rpath,'$ORIGIN:$ORIGIN/../../lib'")
+ list(APPEND media_plugin_cef_LINK_LIBRARIES llwindow )
elseif (DARWIN)
- list(APPEND media_plugin_cef_SOURCE_FILES mac_volume_catcher_null.cpp)
+ list(APPEND media_plugin_cef_SOURCE_FILES volume_catcher_null.cpp)
find_library(CORESERVICES_LIBRARY CoreServices)
find_library(AUDIOUNIT_LIBRARY AudioUnit)
set( media_plugin_cef_LINK_LIBRARIES
@@ -60,6 +78,7 @@ add_library(media_plugin_cef
target_link_libraries(media_plugin_cef
media_plugin_base
ll::cef
+ ll::glib_headers
)
if (WINDOWS)
diff --git a/indra/media_plugins/cef/linux/volume_catcher_linux.cpp b/indra/media_plugins/cef/linux/volume_catcher_linux.cpp
new file mode 100644
index 0000000000..7d33242063
--- /dev/null
+++ b/indra/media_plugins/cef/linux/volume_catcher_linux.cpp
@@ -0,0 +1,78 @@
+/**
+ * @file volume_catcher.cpp
+ * @brief Linux volume catcher which will pick an implementation to use
+ *
+ * @cond
+ * $LicenseInfo:firstyear=2010&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ * @endcond
+ */
+
+#include "volume_catcher_linux.h"
+
+VolumeCatcher::VolumeCatcher()
+{
+}
+
+void VolumeCatcher::onEnablePipeWireVolumeCatcher(bool enable)
+{
+ if (pimpl != nullptr)
+ return;
+
+ if (enable)
+ {
+ LL_DEBUGS() << "volume catcher using pipewire" << LL_ENDL;
+ pimpl = new VolumeCatcherPipeWire();
+ }
+ else
+ {
+ LL_DEBUGS() << "volume catcher using pulseaudio" << LL_ENDL;
+ pimpl = new VolumeCatcherPulseAudio();
+ }
+}
+
+VolumeCatcher::~VolumeCatcher()
+{
+ if (pimpl != nullptr)
+ {
+ delete pimpl;
+ pimpl = nullptr;
+ }
+}
+
+void VolumeCatcher::setVolume(F32 volume)
+{
+ if (pimpl != nullptr) {
+ pimpl->setVolume(volume);
+ }
+}
+
+void VolumeCatcher::setPan(F32 pan)
+{
+ if (pimpl != nullptr)
+ pimpl->setPan(pan);
+}
+
+void VolumeCatcher::pump()
+{
+ if (pimpl != nullptr)
+ pimpl->pump();
+}
diff --git a/indra/media_plugins/cef/linux/volume_catcher_linux.h b/indra/media_plugins/cef/linux/volume_catcher_linux.h
new file mode 100644
index 0000000000..505f9ffb31
--- /dev/null
+++ b/indra/media_plugins/cef/linux/volume_catcher_linux.h
@@ -0,0 +1,149 @@
+/**
+ * @file volume_catcher_impl.h
+ * @brief
+ *
+ * @cond
+ * $LicenseInfo:firstyear=2010&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ * @endcond
+ */
+
+#ifndef VOLUME_CATCHER_LINUX_H
+#define VOLUME_CATCHER_LINUX_H
+
+#include "linden_common.h"
+
+#include "../volume_catcher.h"
+
+#include <unordered_set>
+#include <mutex>
+
+extern "C" {
+// There's no special reason why we want the *glib* PA mainloop, but the generic polling implementation seems broken.
+#include <pulse/glib-mainloop.h>
+#include <pulse/context.h>
+
+#include <pipewire/pipewire.h>
+
+#include "apr_pools.h"
+#include "apr_dso.h"
+}
+
+#include "media_plugin_base.h"
+
+class VolumeCatcherImpl
+{
+public:
+ virtual ~VolumeCatcherImpl() = default;
+
+ virtual void setVolume(F32 volume) = 0; // 0.0 - 1.0
+
+ // Set the left-right pan of audio sources
+ // where -1.0 = left, 0 = center, and 1.0 = right
+ virtual void setPan(F32 pan) = 0;
+
+ virtual void pump() = 0; // call this at least a few times a second if you can - it affects how quickly we can 'catch' a new audio source and adjust its volume
+};
+
+class VolumeCatcherPulseAudio : public VolumeCatcherImpl
+{
+public:
+ VolumeCatcherPulseAudio();
+ ~VolumeCatcherPulseAudio();
+
+ void setVolume(F32 volume);
+ void setPan(F32 pan);
+ void pump();
+
+ // for internal use - can't be private because used from our C callbacks
+
+ bool loadsyms(std::string pa_dso_name);
+ void init();
+ void cleanup();
+
+ void update_all_volumes(F32 volume);
+ void update_index_volume(U32 index, F32 volume);
+ void connected_okay();
+
+ std::set<U32> mSinkInputIndices;
+ std::map<U32,U32> mSinkInputNumChannels;
+ F32 mDesiredVolume;
+ pa_glib_mainloop *mMainloop;
+ pa_context *mPAContext;
+ bool mConnected;
+ bool mGotSyms;
+};
+
+class VolumeCatcherPipeWire : public VolumeCatcherImpl
+{
+public:
+ VolumeCatcherPipeWire();
+ ~VolumeCatcherPipeWire();
+
+ bool loadsyms(std::string pw_dso_name);
+ void init();
+ void cleanup();
+
+ // some of these should be private
+
+ void lock();
+ void unlock();
+
+ void setVolume(F32 volume);
+ void setPan(F32 pan);
+ void pump();
+
+ void handleRegistryEventGlobal(
+ uint32_t id, uint32_t permissions, const char* type,
+ uint32_t version, const struct spa_dict* props
+ );
+
+ class ChildNode
+ {
+ public:
+ bool mActive = false;
+
+ pw_proxy* mProxy = nullptr;
+ spa_hook mNodeListener {};
+ spa_hook mProxyListener {};
+ VolumeCatcherPipeWire* mImpl = nullptr;
+
+ void updateVolume();
+ void destroy();
+ };
+
+ bool mGotSyms = false;
+
+ F32 mVolume = 1.0f; // max by default
+ // F32 mPan = 0.0f; // center
+
+ pw_thread_loop* mThreadLoop = nullptr;
+ pw_context* mContext = nullptr;
+ pw_core* mCore = nullptr;
+ pw_registry* mRegistry = nullptr;
+ spa_hook mRegistryListener;
+
+ std::unordered_set<ChildNode*> mChildNodes;
+ std::mutex mChildNodesMutex;
+ std::mutex mCleanupMutex;
+};
+
+#endif // VOLUME_CATCHER_LINUX_H
diff --git a/indra/media_plugins/cef/linux/volume_catcher_pipewire.cpp b/indra/media_plugins/cef/linux/volume_catcher_pipewire.cpp
new file mode 100755
index 0000000000..a8f1366d6f
--- /dev/null
+++ b/indra/media_plugins/cef/linux/volume_catcher_pipewire.cpp
@@ -0,0 +1,333 @@
+/**
+ * @file volume_catcher_pipewire.cpp
+ * @brief A Linux-specific, PipeWire-specific hack to detect and volume-adjust new audio sources
+ *
+ * @cond
+ * $LicenseInfo:firstyear=2010&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ * @endcond
+ */
+
+/*
+ The high-level design is as follows:
+ 1) Connect to the PipeWire daemon
+ 2) Find all existing and new audio nodes
+ 3) Examine PID and parent PID's to see if it belongs to our process
+ 4) If so, tell PipeWire to adjust the volume of that node
+ 5) Keep a list of all audio nodes and adjust when we setVolume()
+ */
+
+#include "linden_common.h"
+
+#include "volume_catcher_linux.h"
+
+extern "C" {
+#include <spa/pod/builder.h>
+#include <spa/param/props.h>
+}
+
+SymbolGrabber pwSymbolGrabber;
+
+#include "volume_catcher_pipewire_syms.inc"
+
+////////////////////////////////////////////////////
+
+VolumeCatcherPipeWire::VolumeCatcherPipeWire()
+{
+ init();
+}
+
+VolumeCatcherPipeWire::~VolumeCatcherPipeWire()
+{
+ cleanup();
+}
+
+static void registryEventGlobal(
+ void *data, uint32_t id, uint32_t permissions, const char *type,
+ uint32_t version, const struct spa_dict *props)
+{
+ static_cast<VolumeCatcherPipeWire*>(data)->handleRegistryEventGlobal(
+ id, permissions, type, version, props
+ );
+}
+
+static const struct pw_registry_events REGISTRY_EVENTS = {
+ .version = PW_VERSION_REGISTRY_EVENTS,
+ .global = registryEventGlobal,
+};
+
+bool VolumeCatcherPipeWire::loadsyms(std::string pw_dso_name)
+{
+ return pwSymbolGrabber.grabSymbols({ pw_dso_name });
+}
+
+void VolumeCatcherPipeWire::init()
+{
+ LL_DEBUGS() << "init" << LL_ENDL;
+
+ mGotSyms = loadsyms("libpipewire-0.3.so.0");
+
+ if (!mGotSyms)
+ return;
+
+ LL_DEBUGS() << "successfully got symbols" << LL_ENDL;
+
+ llpw_init(nullptr, nullptr);
+
+ mThreadLoop = llpw_thread_loop_new("SL Plugin Volume Adjuster", nullptr);
+
+ if (!mThreadLoop)
+ return;
+
+ // i dont think we need to lock this early
+ // std::lock_guard pwLock(*this);
+
+ mContext = llpw_context_new(
+ llpw_thread_loop_get_loop(mThreadLoop), nullptr, 0
+ );
+
+ if (!mContext)
+ return;
+
+ mCore = llpw_context_connect(mContext, nullptr, 0);
+
+ if (!mCore)
+ return;
+
+ mRegistry = pw_core_get_registry(mCore, PW_VERSION_REGISTRY, 0);
+
+ LL_DEBUGS() << "pw_core_get_registry: " << (mRegistry?"success":"nullptr") << LL_ENDL;
+
+ spa_zero(mRegistryListener);
+
+ pw_registry_add_listener(
+ mRegistry, &mRegistryListener, &REGISTRY_EVENTS, this
+ );
+
+ llpw_thread_loop_start(mThreadLoop);
+
+ LL_DEBUGS() << "thread loop started" << LL_ENDL;
+}
+
+void VolumeCatcherPipeWire::cleanup()
+{
+ {
+ std::unique_lock childNodesLock(mChildNodesMutex);
+ for (auto *childNode: mChildNodes)
+ childNode->destroy();
+
+ mChildNodes.clear();
+ }
+
+ {
+ std::unique_lock pwLock(mCleanupMutex);
+ if (mRegistry)
+ llpw_proxy_destroy((struct pw_proxy *) mRegistry);
+
+ spa_zero(mRegistryListener);
+
+ if (mCore)
+ llpw_core_disconnect(mCore);
+ if (mContext)
+ llpw_context_destroy(mContext);
+ }
+
+ if (!mThreadLoop)
+ return;
+
+ llpw_thread_loop_stop(mThreadLoop);
+ llpw_thread_loop_destroy(mThreadLoop);
+
+ LL_DEBUGS() << "cleanup done" << LL_ENDL;
+}
+
+void VolumeCatcherPipeWire::lock()
+{
+ if (!mThreadLoop)
+ return;
+
+ llpw_thread_loop_lock(mThreadLoop);
+}
+
+void VolumeCatcherPipeWire::unlock()
+{
+ if (!mThreadLoop)
+ return;
+
+ llpw_thread_loop_unlock(mThreadLoop);
+}
+
+const uint32_t channels = 1;
+const float resetVolumes[channels] = { 1.0f };
+
+void VolumeCatcherPipeWire::ChildNode::updateVolume()
+{
+ if (!mActive)
+ return;
+
+ F32 volume = std::clamp(mImpl->mVolume, 0.0f, 1.0f);
+
+ const float volumes[channels] = { volume };
+
+ uint8_t buffer[512];
+
+ spa_pod_builder builder;
+ spa_pod_builder_init(&builder, buffer, sizeof(buffer));
+
+ spa_pod_frame frame;
+ spa_pod_builder_push_object(&builder, &frame, SPA_TYPE_OBJECT_Props, SPA_PARAM_Props);
+
+ // resets system-wide memorized volume for chromium (not google chrome) to 100%
+ spa_pod_builder_prop(&builder, SPA_PROP_channelVolumes, 0);
+ spa_pod_builder_array(&builder, sizeof(float), SPA_TYPE_Float, channels, resetVolumes);
+
+ // sets temporary volume
+ spa_pod_builder_prop(&builder, SPA_PROP_softVolumes, 0);
+ spa_pod_builder_array(&builder, sizeof(float), SPA_TYPE_Float, channels, volumes);
+
+ spa_pod* pod = static_cast<spa_pod*>(spa_pod_builder_pop(&builder, &frame));
+
+ {
+ std::lock_guard pwLock(*mImpl);
+ pw_node_set_param(mProxy, SPA_PARAM_Props, 0, pod);
+ }
+}
+
+void VolumeCatcherPipeWire::ChildNode::destroy()
+{
+ if (!mActive)
+ return;
+
+ mActive = false;
+
+ {
+ std::unique_lock childNodesLock(mImpl->mChildNodesMutex);
+ mImpl->mChildNodes.erase(this);
+ }
+
+ spa_hook_remove(&mNodeListener);
+ spa_hook_remove(&mProxyListener);
+
+ {
+ std::lock_guard pwLock(*mImpl);
+ llpw_proxy_destroy(mProxy);
+ }
+}
+
+static void nodeEventInfo(void* data, const struct pw_node_info* info)
+{
+ const char* processId = spa_dict_lookup(info->props, PW_KEY_APP_PROCESS_ID);
+
+ if (processId == nullptr)
+ return;
+
+ pid_t pid = atoll(processId);
+
+ if (!isPluginPid(pid))
+ return;
+
+ const char* appName = spa_dict_lookup(info->props, PW_KEY_APP_NAME);
+ LL_DEBUGS() << "got app: " << appName << LL_ENDL;
+
+ auto* const childNode = static_cast<VolumeCatcherPipeWire::ChildNode*>(data);
+ LL_DEBUGS() << "init volume: " << childNode->mImpl->mVolume << LL_ENDL;
+
+ childNode->updateVolume();
+
+ {
+ std::lock_guard childNodesLock(childNode->mImpl->mChildNodesMutex);
+ childNode->mImpl->mChildNodes.insert(childNode);
+ }
+}
+
+static const struct pw_node_events NODE_EVENTS = {
+ .version = PW_VERSION_CLIENT_EVENTS,
+ .info = nodeEventInfo,
+};
+
+static void proxyEventDestroy(void* data)
+{
+ auto* const childNode = static_cast<VolumeCatcherPipeWire::ChildNode*>(data);
+ childNode->destroy();
+}
+
+static void proxyEventRemoved(void* data)
+{
+ auto* const childNode = static_cast<VolumeCatcherPipeWire::ChildNode*>(data);
+ childNode->destroy();
+}
+
+static const struct pw_proxy_events PROXY_EVENTS = {
+ .version = PW_VERSION_PROXY_EVENTS,
+ .destroy = proxyEventDestroy,
+ .removed = proxyEventRemoved,
+};
+
+void VolumeCatcherPipeWire::handleRegistryEventGlobal(
+ uint32_t id, uint32_t permissions, const char *type, uint32_t version,
+ const struct spa_dict *props)
+{
+ if (props == nullptr || type == nullptr || strcmp(type, PW_TYPE_INTERFACE_Node) != 0)
+ return;
+
+ const char* mediaClass = spa_dict_lookup(props, PW_KEY_MEDIA_CLASS);
+
+ if (mediaClass == nullptr || strcmp(mediaClass, "Stream/Output/Audio") != 0)
+ return;
+
+ pw_proxy* proxy = static_cast<pw_proxy*>(
+ pw_registry_bind(mRegistry, id, type, PW_VERSION_CLIENT, sizeof(ChildNode))
+ );
+
+ auto* const childNode = static_cast<ChildNode*>(llpw_proxy_get_user_data(proxy));
+
+ childNode->mActive = true;
+ childNode->mProxy = proxy;
+ childNode->mImpl = this;
+
+ pw_node_add_listener(proxy, &childNode->mNodeListener, &NODE_EVENTS, childNode);
+ llpw_proxy_add_listener(proxy, &childNode->mProxyListener, &PROXY_EVENTS, childNode);
+}
+
+void VolumeCatcherPipeWire::setVolume(F32 volume)
+{
+ LL_DEBUGS() << "setting volume to: " << volume << LL_ENDL;
+
+ mVolume = volume;
+
+ {
+ std::unique_lock childNodeslock(mChildNodesMutex);
+ std::unordered_set<ChildNode *> copyOfChildNodes(mChildNodes);
+
+ LL_DEBUGS() << "found " << copyOfChildNodes.size() << " child nodes" << LL_ENDL;
+
+ for (auto* childNode : copyOfChildNodes)
+ childNode->updateVolume();
+ }
+}
+
+void VolumeCatcherPipeWire::setPan(F32 pan)
+{
+}
+
+void VolumeCatcherPipeWire::pump()
+{
+}
diff --git a/indra/media_plugins/cef/linux/volume_catcher_pipewire_syms.inc b/indra/media_plugins/cef/linux/volume_catcher_pipewire_syms.inc
new file mode 100644
index 0000000000..dbc0f5f169
--- /dev/null
+++ b/indra/media_plugins/cef/linux/volume_catcher_pipewire_syms.inc
@@ -0,0 +1,26 @@
+#define G pwSymbolGrabber
+
+// required symbols to grab
+LL_GRAB_SYM(G, true, pw_init, void, int *argc, char **argv[]);
+// LL_GRAB_SYM(G, true, pw_main_loop_new, struct pw_main_loop *, const struct spa_dict *props);
+// LL_GRAB_SYM(G, true, pw_main_loop_get_loop, struct pw_loop *, struct pw_main_loop *loop);
+// LL_GRAB_SYM(G, true, pw_main_loop_destroy, void, struct pw_main_loop *loop);
+// LL_GRAB_SYM(G, true, pw_main_loop_run, void, struct pw_main_loop *loop);
+LL_GRAB_SYM(G, true, pw_context_new, struct pw_context *, struct pw_loop *main_loop, struct pw_properties *props, size_t user_data_size);
+LL_GRAB_SYM(G, true, pw_context_destroy, void, struct pw_context *context);
+LL_GRAB_SYM(G, true, pw_context_connect, struct pw_core *, struct pw_context *context, struct pw_properties *properties, size_t user_data_size);
+LL_GRAB_SYM(G, true, pw_thread_loop_new, struct pw_thread_loop *, const char *name, const struct spa_dict *props);
+LL_GRAB_SYM(G, true, pw_thread_loop_destroy, void, struct pw_thread_loop *loop);
+LL_GRAB_SYM(G, true, pw_thread_loop_get_loop, struct pw_loop *, struct pw_thread_loop *loop);
+LL_GRAB_SYM(G, true, pw_thread_loop_start, int, struct pw_thread_loop *loop);
+LL_GRAB_SYM(G, true, pw_thread_loop_stop, void, struct pw_thread_loop *loop);
+LL_GRAB_SYM(G, true, pw_thread_loop_lock, void, struct pw_thread_loop *loop);
+LL_GRAB_SYM(G, true, pw_thread_loop_unlock, void, struct pw_thread_loop *loop);
+LL_GRAB_SYM(G, true, pw_proxy_add_listener, void, struct pw_proxy *proxy, struct spa_hook *listener, const struct pw_proxy_events *events, void *data);
+LL_GRAB_SYM(G, true, pw_proxy_destroy, void, struct pw_proxy *proxy);
+LL_GRAB_SYM(G, true, pw_proxy_get_user_data, void *, struct pw_proxy *proxy);
+LL_GRAB_SYM(G, true, pw_core_disconnect, int, struct pw_core *core);
+
+// optional symbols to grab
+
+#undef G
diff --git a/indra/media_plugins/cef/linux/volume_catcher_pulseaudio.cpp b/indra/media_plugins/cef/linux/volume_catcher_pulseaudio.cpp
new file mode 100755
index 0000000000..f8a48a91fd
--- /dev/null
+++ b/indra/media_plugins/cef/linux/volume_catcher_pulseaudio.cpp
@@ -0,0 +1,322 @@
+/**
+ * @file volume_catcher_pulseaudio.cpp
+ * @brief A Linux-specific, PulseAudio-specific hack to detect and volume-adjust new audio sources
+ *
+ * @cond
+ * $LicenseInfo:firstyear=2010&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2010, Linden Research, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ * @endcond
+ */
+
+/*
+ The high-level design is as follows:
+ 1) Connect to the PulseAudio daemon
+ 2) Watch for the creation of new audio players connecting to the daemon (this includes ALSA clients running on the PulseAudio emulation layer, such as Flash plugins)
+ 3) Examine any new audio player's PID to see if it belongs to our own process
+ 4) If so, tell PA to adjust the volume of that audio player ('sink input' in PA parlance)
+ 5) Keep a list of all living audio players that we care about, adjust the volumes of all of them when we get a new setVolume() call
+ */
+
+#include "linden_common.h"
+
+#include "volume_catcher_linux.h"
+
+extern "C" {
+#include <glib.h>
+#include <glib-object.h>
+
+#include <pulse/introspect.h>
+
+#include <pulse/subscribe.h>
+}
+
+SymbolGrabber paSymbolGrabber;
+
+#include "volume_catcher_pulseaudio_syms.inc"
+#include "volume_catcher_pulseaudio_glib_syms.inc"
+
+////////////////////////////////////////////////////
+
+// PulseAudio requires a chain of callbacks with C linkage
+extern "C" {
+ void callback_discovered_sinkinput(pa_context *context, const pa_sink_input_info *i, int eol, void *userdata);
+ void callback_subscription_alert(pa_context *context, pa_subscription_event_type_t t, uint32_t index, void *userdata);
+ void callback_context_state(pa_context *context, void *userdata);
+}
+
+VolumeCatcherPulseAudio::VolumeCatcherPulseAudio()
+ : mDesiredVolume(0.0f),
+ mMainloop(nullptr),
+ mPAContext(nullptr),
+ mConnected(false),
+ mGotSyms(false)
+{
+ init();
+}
+
+VolumeCatcherPulseAudio::~VolumeCatcherPulseAudio()
+{
+ cleanup();
+}
+
+bool VolumeCatcherPulseAudio::loadsyms(std::string pulse_dso_name)
+{
+ return paSymbolGrabber.grabSymbols({ pulse_dso_name });
+}
+
+void VolumeCatcherPulseAudio::init()
+{
+ // try to be as defensive as possible because PA's interface is a
+ // bit fragile and (for our purposes) we'd rather simply not function
+ // than crash
+
+ // we cheat and rely upon libpulse-mainloop-glib.so.0 to pull-in
+ // libpulse.so.0 - this isn't a great assumption, and the two DSOs should
+ // probably be loaded separately. Our Linux DSO framework needs refactoring,
+ // we do this sort of thing a lot with practically identical logic...
+ mGotSyms = loadsyms("libpulse-mainloop-glib.so.0");
+
+ if (!mGotSyms)
+ mGotSyms = loadsyms("libpulse.so.0");
+
+ if (!mGotSyms)
+ return;
+
+ mMainloop = llpa_glib_mainloop_new(g_main_context_default());
+
+ if (mMainloop)
+ {
+ pa_mainloop_api *api = llpa_glib_mainloop_get_api(mMainloop);
+
+ if (api)
+ {
+ pa_proplist *proplist = llpa_proplist_new();
+
+ if (proplist)
+ {
+ llpa_proplist_sets(proplist, PA_PROP_APPLICATION_ICON_NAME, "multimedia-player");
+ llpa_proplist_sets(proplist, PA_PROP_APPLICATION_ID, "com.secondlife.viewer.mediaplugvoladjust");
+ llpa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, "SL Plugin Volume Adjuster");
+ llpa_proplist_sets(proplist, PA_PROP_APPLICATION_VERSION, "1");
+
+ // plain old pa_context_new() is broken!
+ mPAContext = llpa_context_new_with_proplist(api, nullptr, proplist);
+
+ llpa_proplist_free(proplist);
+ }
+ }
+ }
+
+ // Now we've set up a PA context and mainloop, try connecting the
+ // PA context to a PA daemon.
+ if (mPAContext)
+ {
+ llpa_context_set_state_callback(mPAContext, callback_context_state, this);
+ pa_context_flags_t cflags = (pa_context_flags)0; // maybe add PA_CONTEXT_NOAUTOSPAWN?
+ if (llpa_context_connect(mPAContext, nullptr, cflags, nullptr) >= 0)
+ {
+ // Okay! We haven't definitely connected, but we
+ // haven't definitely failed yet.
+ }
+ else
+ {
+ // Failed to connect to PA manager... we'll leave
+ // things like that. Perhaps we should try again later.
+ }
+ }
+}
+
+void VolumeCatcherPulseAudio::cleanup()
+{
+ mConnected = false;
+
+ if (mGotSyms && mPAContext)
+ {
+ llpa_context_disconnect(mPAContext);
+ llpa_context_unref(mPAContext);
+ }
+
+ mPAContext = nullptr;
+
+ if (mGotSyms && mMainloop)
+ llpa_glib_mainloop_free(mMainloop);
+
+ mMainloop = nullptr;
+}
+
+void VolumeCatcherPulseAudio::setVolume(F32 volume)
+{
+ mDesiredVolume = volume;
+
+ if (!mGotSyms)
+ return;
+
+ if (mConnected && mPAContext)
+ {
+ update_all_volumes(mDesiredVolume);
+ }
+
+ pump();
+}
+
+void VolumeCatcherPulseAudio::setPan(F32 pan)
+{
+}
+
+void VolumeCatcherPulseAudio::pump()
+{
+ gboolean may_block = FALSE;
+ g_main_context_iteration(g_main_context_default(), may_block);
+}
+
+void VolumeCatcherPulseAudio::connected_okay()
+{
+ pa_operation *op;
+
+ // fetch global list of existing sinkinputs
+ if ((op = llpa_context_get_sink_input_info_list(mPAContext,
+ callback_discovered_sinkinput,
+ this)))
+ {
+ llpa_operation_unref(op);
+ }
+
+ // subscribe to future global sinkinput changes
+ llpa_context_set_subscribe_callback(mPAContext,
+ callback_subscription_alert,
+ this);
+ if ((op = llpa_context_subscribe(mPAContext, (pa_subscription_mask_t)
+ (PA_SUBSCRIPTION_MASK_SINK_INPUT),
+ nullptr, nullptr)))
+ {
+ llpa_operation_unref(op);
+ }
+}
+
+void VolumeCatcherPulseAudio::update_all_volumes(F32 volume)
+{
+ for (std::set<U32>::iterator it = mSinkInputIndices.begin();
+ it != mSinkInputIndices.end(); ++it)
+ {
+ update_index_volume(*it, volume);
+ }
+}
+
+void VolumeCatcherPulseAudio::update_index_volume(U32 index, F32 volume)
+{
+ static pa_cvolume cvol;
+ llpa_cvolume_set(&cvol, mSinkInputNumChannels[index],
+ llpa_sw_volume_from_linear(volume));
+
+ pa_context *c = mPAContext;
+ uint32_t idx = index;
+ const pa_cvolume *cvolumep = &cvol;
+ pa_context_success_cb_t cb = nullptr; // okay as null
+ void *userdata = nullptr; // okay as null
+
+ pa_operation *op;
+ if ((op = llpa_context_set_sink_input_volume(c, idx, cvolumep, cb, userdata)))
+ llpa_operation_unref(op);
+}
+
+void callback_discovered_sinkinput(pa_context *context, const pa_sink_input_info *sii, int eol, void *userdata)
+{
+ VolumeCatcherPulseAudio *impl = dynamic_cast<VolumeCatcherPulseAudio*>((VolumeCatcherPulseAudio*)userdata);
+ llassert(impl);
+
+ if (0 == eol)
+ {
+ pa_proplist *proplist = sii->proplist;
+ pid_t sinkpid = atoll(llpa_proplist_gets(proplist, PA_PROP_APPLICATION_PROCESS_ID));
+
+ if (isPluginPid( sinkpid )) // does the discovered sinkinput belong to this process?
+ {
+ bool is_new = (impl->mSinkInputIndices.find(sii->index) == impl->mSinkInputIndices.end());
+
+ impl->mSinkInputIndices.insert(sii->index);
+ impl->mSinkInputNumChannels[sii->index] = sii->channel_map.channels;
+
+ if (is_new)
+ {
+ // new!
+ impl->update_index_volume(sii->index, impl->mDesiredVolume);
+ }
+ else
+ {
+ // seen it already, do nothing.
+ }
+ }
+ }
+}
+
+void callback_subscription_alert(pa_context *context, pa_subscription_event_type_t t, uint32_t index, void *userdata)
+{
+ VolumeCatcherPulseAudio *impl = dynamic_cast<VolumeCatcherPulseAudio*>((VolumeCatcherPulseAudio*)userdata);
+ llassert(impl);
+
+ switch (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK)
+ {
+ case PA_SUBSCRIPTION_EVENT_SINK_INPUT:
+ if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE)
+ {
+ // forget this sinkinput, if we were caring about it
+ impl->mSinkInputIndices.erase(index);
+ impl->mSinkInputNumChannels.erase(index);
+ }
+ else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW)
+ {
+ // ask for more info about this new sinkinput
+ pa_operation *op;
+ if ((op = llpa_context_get_sink_input_info(impl->mPAContext, index, callback_discovered_sinkinput, impl)))
+ {
+ llpa_operation_unref(op);
+ }
+ }
+ else
+ {
+ // property change on this sinkinput - we don't care.
+ }
+ break;
+
+ default:;
+ }
+}
+
+void callback_context_state(pa_context *context, void *userdata)
+{
+ VolumeCatcherPulseAudio *impl = dynamic_cast<VolumeCatcherPulseAudio*>((VolumeCatcherPulseAudio*)userdata);
+ llassert(impl);
+
+ switch (llpa_context_get_state(context))
+ {
+ case PA_CONTEXT_READY:
+ impl->mConnected = true;
+ impl->connected_okay();
+ break;
+ case PA_CONTEXT_TERMINATED:
+ impl->mConnected = false;
+ break;
+ case PA_CONTEXT_FAILED:
+ impl->mConnected = false;
+ break;
+ default:;
+ }
+}
diff --git a/indra/media_plugins/cef/linux/volume_catcher_pulseaudio_glib_syms.inc b/indra/media_plugins/cef/linux/volume_catcher_pulseaudio_glib_syms.inc
new file mode 100755
index 0000000000..e9b7196e51
--- /dev/null
+++ b/indra/media_plugins/cef/linux/volume_catcher_pulseaudio_glib_syms.inc
@@ -0,0 +1,10 @@
+#define G paSymbolGrabber
+
+// required symbols to grab
+LL_GRAB_SYM(G, true, pa_glib_mainloop_free, void, pa_glib_mainloop* g)
+LL_GRAB_SYM(G, true, pa_glib_mainloop_get_api, pa_mainloop_api*, pa_glib_mainloop* g)
+LL_GRAB_SYM(G, true, pa_glib_mainloop_new, pa_glib_mainloop *, GMainContext *c)
+
+// optional symbols to grab
+
+#undef G
diff --git a/indra/media_plugins/cef/linux/volume_catcher_pulseaudio_syms.inc b/indra/media_plugins/cef/linux/volume_catcher_pulseaudio_syms.inc
new file mode 100755
index 0000000000..4859a34405
--- /dev/null
+++ b/indra/media_plugins/cef/linux/volume_catcher_pulseaudio_syms.inc
@@ -0,0 +1,29 @@
+#define G paSymbolGrabber
+
+// required symbols to grab
+LL_GRAB_SYM(G, true, pa_context_connect, int, pa_context *c, const char *server, pa_context_flags_t flags, const pa_spawn_api *api)
+LL_GRAB_SYM(G, true, pa_context_disconnect, void, pa_context *c)
+LL_GRAB_SYM(G, true, pa_context_get_sink_input_info, pa_operation*, pa_context *c, uint32_t idx, pa_sink_input_info_cb_t cb, void *userdata)
+LL_GRAB_SYM(G, true, pa_context_get_sink_input_info_list, pa_operation*, pa_context *c, pa_sink_input_info_cb_t cb, void *userdata)
+LL_GRAB_SYM(G, true, pa_context_get_state, pa_context_state_t, pa_context *c)
+LL_GRAB_SYM(G, true, pa_context_new_with_proplist, pa_context*, pa_mainloop_api *mainloop, const char *name, pa_proplist *proplist)
+LL_GRAB_SYM(G, true, pa_context_set_sink_input_volume, pa_operation*, pa_context *c, uint32_t idx, const pa_cvolume *volume, pa_context_success_cb_t cb, void *userdata)
+LL_GRAB_SYM(G, true, pa_context_set_state_callback, void, pa_context *c, pa_context_notify_cb_t cb, void *userdata)
+LL_GRAB_SYM(G, true, pa_context_set_subscribe_callback, void, pa_context *c, pa_context_subscribe_cb_t cb, void *userdata)
+LL_GRAB_SYM(G, true, pa_context_subscribe, pa_operation*, pa_context *c, pa_subscription_mask_t m, pa_context_success_cb_t cb, void *userdata)
+LL_GRAB_SYM(G, true, pa_context_unref, void, pa_context *c)
+LL_GRAB_SYM(G, true, pa_cvolume_set, pa_cvolume*, pa_cvolume *a, unsigned channels, pa_volume_t v)
+LL_GRAB_SYM(G, true, pa_operation_unref, void, pa_operation *o)
+LL_GRAB_SYM(G, true, pa_proplist_free, void, pa_proplist* p)
+LL_GRAB_SYM(G, true, pa_proplist_gets, const char*, pa_proplist *p, const char *key)
+LL_GRAB_SYM(G, true, pa_proplist_new, pa_proplist*, void)
+LL_GRAB_SYM(G, true, pa_proplist_sets, int, pa_proplist *p, const char *key, const char *value)
+LL_GRAB_SYM(G, true, pa_sw_volume_from_linear, pa_volume_t, double v)
+// LL_GRAB_SYM(G, true, pa_mainloop_free, void, pa_mainloop *m)
+// LL_GRAB_SYM(G, true, pa_mainloop_get_api, pa_mainloop_api *, pa_mainloop *m)
+// LL_GRAB_SYM(G, true, pa_mainloop_iterate, int, pa_mainloop *m, int block, int *retval)
+// LL_GRAB_SYM(G, true, pa_mainloop_new, pa_mainloop *, void)
+
+// optional symbols to grab
+
+#undef G
diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp
index 64fc7e452b..9c205b558c 100644
--- a/indra/media_plugins/cef/media_plugin_cef.cpp
+++ b/indra/media_plugins/cef/media_plugin_cef.cpp
@@ -886,7 +886,7 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
keyEvent(key_event, native_key_data);
-#elif LL_WINDOWS
+#else
std::string event = message_in.getValue("event");
LLSD native_key_data = message_in.getValueLLSD("native_key_data");
@@ -908,6 +908,13 @@ void MediaPluginCEF::receiveMessage(const char* message_string)
{
mEnableMediaPluginDebugging = message_in.getValueBoolean("enable");
}
+#if LL_LINUX
+ else if (message_name == "enable_pipewire_volume_catcher")
+ {
+ bool enable = message_in.getValueBoolean("enable");
+ mVolumeCatcher.onEnablePipeWireVolumeCatcher(enable);
+ }
+#endif
if (message_name == "pick_file_response")
{
LLSD file_list_llsd = message_in.getValueLLSD("file_list");
@@ -1050,6 +1057,28 @@ void MediaPluginCEF::keyEvent(dullahan::EKeyEvent key_event, LLSD native_key_dat
mCEFLib->nativeKeyboardEventWin(msg, wparam, lparam);
#endif
+
+#if LL_LINUX
+
+ uint32_t native_virtual_key = (uint32_t)(native_key_data["virtual_key"].asInteger()); // this is actually the SDL event.key.keysym.sym;
+ uint32_t native_virtual_key_win = (uint32_t)(native_key_data["virtual_key_win"].asInteger());
+ uint32_t native_modifiers = (uint32_t)(native_key_data["modifiers"].asInteger());
+
+ // only for non-printable keysyms, the actual text input is done in unicodeInput() below
+ if (native_virtual_key <= 0x1b || native_virtual_key >= 0x7f)
+ {
+ // set keypad flag, not sure if this even does anything
+ bool keypad = false;
+ if (native_virtual_key_win >= 0x60 && native_virtual_key_win <= 0x6f)
+ {
+ keypad = true;
+ }
+
+ // yes, we send native_virtual_key_win twice because native_virtual_key breaks it
+ mCEFLib->nativeKeyboardEventSDL2(key_event, native_virtual_key, native_modifiers, keypad);
+ }
+
+#endif // LL_LINUX
};
void MediaPluginCEF::unicodeInput(std::string event, LLSD native_key_data = LLSD::emptyMap())
@@ -1080,6 +1109,16 @@ void MediaPluginCEF::unicodeInput(std::string event, LLSD native_key_data = LLSD
U64 lparam = ll_U32_from_sd(native_key_data["l_param"]);
mCEFLib->nativeKeyboardEventWin(msg, wparam, lparam);
#endif
+
+#if LL_LINUX
+
+ uint32_t native_scan_code = (uint32_t)(native_key_data["sdl_sym"].asInteger());
+ uint32_t native_virtual_key = (uint32_t)(native_key_data["virtual_key"].asInteger());
+ uint32_t native_modifiers = (uint32_t)(native_key_data["modifiers"].asInteger());
+
+ mCEFLib->nativeKeyboardEvent(dullahan::KE_KEY_DOWN, native_scan_code, native_virtual_key, native_modifiers);
+
+#endif // LL_LINUX
};
////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/media_plugins/cef/volume_catcher.h b/indra/media_plugins/cef/volume_catcher.h
index ea97a24947..6933854e8e 100644
--- a/indra/media_plugins/cef/volume_catcher.h
+++ b/indra/media_plugins/cef/volume_catcher.h
@@ -35,19 +35,20 @@ class VolumeCatcherImpl;
class VolumeCatcher
{
- public:
+public:
VolumeCatcher();
~VolumeCatcher();
- void setVolume(F32 volume); // 0.0 - 1.0
-
- // Set the left-right pan of audio sources
- // where -1.0 = left, 0 = center, and 1.0 = right
+ void setVolume(F32 volume);
void setPan(F32 pan);
- void pump(); // call this at least a few times a second if you can - it affects how quickly we can 'catch' a new audio source and adjust its volume
+ void pump();
+
+#if LL_LINUX
+ void onEnablePipeWireVolumeCatcher(bool enable);
+#endif
- private:
+private:
VolumeCatcherImpl *pimpl;
};
diff --git a/indra/media_plugins/cef/mac_volume_catcher_null.cpp b/indra/media_plugins/cef/volume_catcher_null.cpp
index c479e24a95..1f0f1e8e38 100644
--- a/indra/media_plugins/cef/mac_volume_catcher_null.cpp
+++ b/indra/media_plugins/cef/volume_catcher_null.cpp
@@ -1,5 +1,5 @@
/**
- * @file windows_volume_catcher.cpp
+ * @file volume_catcher_null.cpp
* @brief A null implementation of volume level control of all audio channels opened by a process.
* We are using this for the macOS version for now until we can understand how to make the
* exitising mac_volume_catcher.cpp work without the (now, non-existant) QuickTime dependency
@@ -29,67 +29,25 @@
*/
#include "volume_catcher.h"
-#include "llsingleton.h"
-class VolumeCatcherImpl : public LLSingleton<VolumeCatcherImpl>
-{
- LLSINGLETON(VolumeCatcherImpl);
- // This is a singleton class -- both callers and the component implementation should use getInstance() to find the instance.
- ~VolumeCatcherImpl();
-
-public:
-
- void setVolume(F32 volume);
- void setPan(F32 pan);
-
-private:
- F32 mVolume;
- F32 mPan;
- bool mSystemIsVistaOrHigher;
-};
-
-VolumeCatcherImpl::VolumeCatcherImpl()
-: mVolume(1.0f), // default volume is max
- mPan(0.f) // default pan is centered
-{
-}
-
-VolumeCatcherImpl::~VolumeCatcherImpl()
-{
-}
-
-void VolumeCatcherImpl::setVolume(F32 volume)
-{
- mVolume = volume;
-}
-
-void VolumeCatcherImpl::setPan(F32 pan)
-{ // remember pan for calculating individual channel levels later
- mPan = pan;
-}
/////////////////////////////////////////////////////
VolumeCatcher::VolumeCatcher()
{
- pimpl = VolumeCatcherImpl::getInstance();
}
VolumeCatcher::~VolumeCatcher()
{
- // Let the instance persist until exit.
}
void VolumeCatcher::setVolume(F32 volume)
{
- pimpl->setVolume(volume);
}
void VolumeCatcher::setPan(F32 pan)
{
- pimpl->setPan(pan);
}
void VolumeCatcher::pump()
{
- // No periodic tasks are necessary for this implementation.
}
diff --git a/indra/media_plugins/cef/windows_volume_catcher.cpp b/indra/media_plugins/cef/windows_volume_catcher.cpp
index e7daeb5f74..1e52fee9de 100644
--- a/indra/media_plugins/cef/windows_volume_catcher.cpp
+++ b/indra/media_plugins/cef/windows_volume_catcher.cpp
@@ -44,7 +44,6 @@ public:
private:
F32 mVolume;
F32 mPan;
- bool mSystemIsVistaOrHigher;
};
VolumeCatcherImpl::VolumeCatcherImpl()
diff --git a/indra/media_plugins/example/CMakeLists.txt b/indra/media_plugins/example/CMakeLists.txt
index 41e2353f31..71343d5f85 100644
--- a/indra/media_plugins/example/CMakeLists.txt
+++ b/indra/media_plugins/example/CMakeLists.txt
@@ -13,14 +13,6 @@ include(ExamplePlugin)
### media_plugin_example
-if(NOT ADDRESS_SIZE EQUAL 32)
- if(WINDOWS)
- ##add_definitions(/FIXED:NO)
- else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
- add_definitions(-fPIC)
- endif(WINDOWS)
-endif(NOT ADDRESS_SIZE EQUAL 32)
-
set(media_plugin_example_SOURCE_FILES
media_plugin_example.cpp
)
diff --git a/indra/media_plugins/gstreamer010/CMakeLists.txt b/indra/media_plugins/gstreamer010/CMakeLists.txt
deleted file mode 100644
index 38fc8201bf..0000000000
--- a/indra/media_plugins/gstreamer010/CMakeLists.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-# -*- cmake -*-
-
-project(media_plugin_gstreamer010)
-
-include(00-Common)
-include(LLCommon)
-include(LLImage)
-include(LLMath)
-include(LLWindow)
-include(Linking)
-include(PluginAPI)
-include(OpenGL)
-
-include(GStreamer010Plugin)
-
-### media_plugin_gstreamer010
-
-if(NOT ADDRESS_SIZE EQUAL 32)
- if(WINDOWS)
- ##add_definitions(/FIXED:NO)
- else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
- add_definitions(-fPIC)
- endif(WINDOWS)
-endif(NOT ADDRESS_SIZE EQUAL 32)
-
-set(media_plugin_gstreamer010_SOURCE_FILES
- media_plugin_gstreamer010.cpp
- llmediaimplgstreamer_syms.cpp
- llmediaimplgstreamervidplug.cpp
- )
-
-set(media_plugin_gstreamer010_HEADER_FILES
- llmediaimplgstreamervidplug.h
- llmediaimplgstreamer_syms.h
- llmediaimplgstreamertriviallogging.h
- )
-
-add_library(media_plugin_gstreamer010
- SHARED
- ${media_plugin_gstreamer010_SOURCE_FILES}
- )
-
-target_link_libraries(media_plugin_gstreamer010
- media_plugin_base
- ll::gstreamer
- )
diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms.cpp b/indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms.cpp
deleted file mode 100644
index dcc04b37e4..0000000000
--- a/indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/**
- * @file llmediaimplgstreamer_syms.cpp
- * @brief dynamic GStreamer symbol-grabbing code
- *
- * @cond
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- * @endcond
- */
-
-#if LL_GSTREAMER010_ENABLED
-
-#include <string>
-
-extern "C" {
-#include <gst/gst.h>
-
-#include "apr_pools.h"
-#include "apr_dso.h"
-}
-
-#include "llmediaimplgstreamertriviallogging.h"
-
-#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) RTN (*ll##GSTSYM)(__VA_ARGS__) = NULL
-#include "llmediaimplgstreamer_syms_raw.inc"
-#include "llmediaimplgstreamer_syms_rawv.inc"
-#undef LL_GST_SYM
-
-// a couple of stubs for disgusting reasons
-GstDebugCategory*
-ll_gst_debug_category_new(gchar *name, guint color, gchar *description)
-{
- static GstDebugCategory dummy;
- return &dummy;
-}
-void ll_gst_debug_register_funcptr(GstDebugFuncPtr func, gchar* ptrname)
-{
-}
-
-static bool sSymsGrabbed = false;
-static apr_pool_t *sSymGSTDSOMemoryPool = NULL;
-static apr_dso_handle_t *sSymGSTDSOHandleG = NULL;
-static apr_dso_handle_t *sSymGSTDSOHandleV = NULL;
-
-
-bool grab_gst_syms(std::string gst_dso_name,
- std::string gst_dso_name_vid)
-{
- if (sSymsGrabbed)
- {
- // already have grabbed good syms
- return TRUE;
- }
-
- bool sym_error = false;
- bool rtn = false;
- apr_status_t rv;
- apr_dso_handle_t *sSymGSTDSOHandle = NULL;
-
-#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##GSTSYM, sSymGSTDSOHandle, #GSTSYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #GSTSYM); if (REQ) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #GSTSYM, (void*)ll##GSTSYM);}while(0)
-
- //attempt to load the shared libraries
- apr_pool_create(&sSymGSTDSOMemoryPool, NULL);
-
- if ( APR_SUCCESS == (rv = apr_dso_load(&sSymGSTDSOHandle,
- gst_dso_name.c_str(),
- sSymGSTDSOMemoryPool) ))
- {
- INFOMSG("Found DSO: %s", gst_dso_name.c_str());
-#include "llmediaimplgstreamer_syms_raw.inc"
-
- if ( sSymGSTDSOHandle )
- {
- sSymGSTDSOHandleG = sSymGSTDSOHandle;
- sSymGSTDSOHandle = NULL;
- }
-
- if ( APR_SUCCESS ==
- (rv = apr_dso_load(&sSymGSTDSOHandle,
- gst_dso_name_vid.c_str(),
- sSymGSTDSOMemoryPool) ))
- {
- INFOMSG("Found DSO: %s", gst_dso_name_vid.c_str());
-#include "llmediaimplgstreamer_syms_rawv.inc"
- rtn = !sym_error;
- }
- else
- {
- INFOMSG("Couldn't load DSO: %s", gst_dso_name_vid.c_str());
- rtn = false; // failure
- }
- }
- else
- {
- INFOMSG("Couldn't load DSO: %s", gst_dso_name.c_str());
- rtn = false; // failure
- }
-
- if (sym_error)
- {
- WARNMSG("Failed to find necessary symbols in GStreamer libraries.");
- }
-
- if ( sSymGSTDSOHandle )
- {
- sSymGSTDSOHandleV = sSymGSTDSOHandle;
- sSymGSTDSOHandle = NULL;
- }
-#undef LL_GST_SYM
-
- sSymsGrabbed = !!rtn;
- return rtn;
-}
-
-
-void ungrab_gst_syms()
-{
- // should be safe to call regardless of whether we've
- // actually grabbed syms.
-
- if ( sSymGSTDSOHandleG )
- {
- apr_dso_unload(sSymGSTDSOHandleG);
- sSymGSTDSOHandleG = NULL;
- }
-
- if ( sSymGSTDSOHandleV )
- {
- apr_dso_unload(sSymGSTDSOHandleV);
- sSymGSTDSOHandleV = NULL;
- }
-
- if ( sSymGSTDSOMemoryPool )
- {
- apr_pool_destroy(sSymGSTDSOMemoryPool);
- sSymGSTDSOMemoryPool = NULL;
- }
-
- // NULL-out all of the symbols we'd grabbed
-#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) do{ll##GSTSYM = NULL;}while(0)
-#include "llmediaimplgstreamer_syms_raw.inc"
-#include "llmediaimplgstreamer_syms_rawv.inc"
-#undef LL_GST_SYM
-
- sSymsGrabbed = false;
-}
-
-
-#endif // LL_GSTREAMER010_ENABLED
diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms.h b/indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms.h
deleted file mode 100644
index 57d446c7df..0000000000
--- a/indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * @file llmediaimplgstreamer_syms.h
- * @brief dynamic GStreamer symbol-grabbing code
- *
- * @cond
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- * @endcond
- */
-
-#include "linden_common.h"
-
-#if LL_GSTREAMER010_ENABLED
-
-extern "C" {
-#include <gst/gst.h>
-}
-
-bool grab_gst_syms(std::string gst_dso_name,
- std::string gst_dso_name_vid);
-void ungrab_gst_syms();
-
-#define LL_GST_SYM(REQ, GSTSYM, RTN, ...) extern RTN (*ll##GSTSYM)(__VA_ARGS__)
-#include "llmediaimplgstreamer_syms_raw.inc"
-#include "llmediaimplgstreamer_syms_rawv.inc"
-#undef LL_GST_SYM
-
-// regrettable hacks to give us better runtime compatibility with older systems
-#define llg_return_if_fail(COND) do{if (!(COND)) return;}while(0)
-#define llg_return_val_if_fail(COND,V) do{if (!(COND)) return V;}while(0)
-
-// regrettable hacks because GStreamer was not designed for runtime loading
-#undef GST_TYPE_MESSAGE
-#define GST_TYPE_MESSAGE (llgst_message_get_type())
-#undef GST_TYPE_OBJECT
-#define GST_TYPE_OBJECT (llgst_object_get_type())
-#undef GST_TYPE_PIPELINE
-#define GST_TYPE_PIPELINE (llgst_pipeline_get_type())
-#undef GST_TYPE_ELEMENT
-#define GST_TYPE_ELEMENT (llgst_element_get_type())
-#undef GST_TYPE_VIDEO_SINK
-#define GST_TYPE_VIDEO_SINK (llgst_video_sink_get_type())
-// more regrettable hacks to stub-out these .h-exposed GStreamer internals
-void ll_gst_debug_register_funcptr(GstDebugFuncPtr func, gchar* ptrname);
-#undef _gst_debug_register_funcptr
-#define _gst_debug_register_funcptr ll_gst_debug_register_funcptr
-GstDebugCategory* ll_gst_debug_category_new(gchar *name, guint color, gchar *description);
-#undef _gst_debug_category_new
-#define _gst_debug_category_new ll_gst_debug_category_new
-#undef __gst_debug_enabled
-#define __gst_debug_enabled (0)
-
-// more hacks
-#define LLGST_MESSAGE_TYPE_NAME(M) (llgst_message_type_get_name(GST_MESSAGE_TYPE(M)))
-
-#endif // LL_GSTREAMER010_ENABLED
diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms_raw.inc b/indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms_raw.inc
deleted file mode 100644
index b33e59363d..0000000000
--- a/indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms_raw.inc
+++ /dev/null
@@ -1,51 +0,0 @@
-
-// required symbols to grab
-LL_GST_SYM(true, gst_pad_peer_accept_caps, gboolean, GstPad *pad, GstCaps *caps);
-LL_GST_SYM(true, gst_buffer_new, GstBuffer*, void);
-LL_GST_SYM(true, gst_buffer_set_caps, void, GstBuffer*, GstCaps *);
-LL_GST_SYM(true, gst_structure_set_value, void, GstStructure *, const gchar *, const GValue*);
-LL_GST_SYM(true, gst_init_check, gboolean, int *argc, char **argv[], GError ** err);
-LL_GST_SYM(true, gst_message_get_type, GType, void);
-LL_GST_SYM(true, gst_message_type_get_name, const gchar*, GstMessageType type);
-LL_GST_SYM(true, gst_message_parse_error, void, GstMessage *message, GError **gerror, gchar **debug);
-LL_GST_SYM(true, gst_message_parse_warning, void, GstMessage *message, GError **gerror, gchar **debug);
-LL_GST_SYM(true, gst_message_parse_state_changed, void, GstMessage *message, GstState *oldstate, GstState *newstate, GstState *pending);
-LL_GST_SYM(true, gst_element_set_state, GstStateChangeReturn, GstElement *element, GstState state);
-LL_GST_SYM(true, gst_object_unref, void, gpointer object);
-LL_GST_SYM(true, gst_object_get_type, GType, void);
-LL_GST_SYM(true, gst_pipeline_get_type, GType, void);
-LL_GST_SYM(true, gst_pipeline_get_bus, GstBus*, GstPipeline *pipeline);
-LL_GST_SYM(true, gst_bus_add_watch, guint, GstBus * bus, GstBusFunc func, gpointer user_data);
-LL_GST_SYM(true, gst_element_factory_make, GstElement*, const gchar *factoryname, const gchar *name);
-LL_GST_SYM(true, gst_element_get_type, GType, void);
-LL_GST_SYM(true, gst_static_pad_template_get, GstPadTemplate*, GstStaticPadTemplate *pad_template);
-LL_GST_SYM(true, gst_element_class_add_pad_template, void, GstElementClass *klass, GstPadTemplate *temp);
-LL_GST_SYM(true, gst_element_class_set_details, void, GstElementClass *klass, const GstElementDetails *details);
-LL_GST_SYM(true, gst_caps_unref, void, GstCaps* caps);
-LL_GST_SYM(true, gst_caps_ref, GstCaps *, GstCaps* caps);
-//LL_GST_SYM(true, gst_caps_is_empty, gboolean, const GstCaps *caps);
-LL_GST_SYM(true, gst_caps_from_string, GstCaps *, const gchar *string);
-LL_GST_SYM(true, gst_caps_replace, void, GstCaps **caps, GstCaps *newcaps);
-LL_GST_SYM(true, gst_caps_get_structure, GstStructure *, const GstCaps *caps, guint index);
-LL_GST_SYM(true, gst_caps_copy, GstCaps *, const GstCaps * caps);
-//LL_GST_SYM(true, gst_caps_intersect, GstCaps *, const GstCaps *caps1, const GstCaps *caps2);
-LL_GST_SYM(true, gst_element_register, gboolean, GstPlugin *plugin, const gchar *name, guint rank, GType type);
-LL_GST_SYM(true, _gst_plugin_register_static, void, GstPluginDesc *desc);
-LL_GST_SYM(true, gst_structure_get_int, gboolean, const GstStructure *structure, const gchar *fieldname, gint *value);
-LL_GST_SYM(true, gst_structure_get_value, G_CONST_RETURN GValue *, const GstStructure *structure, const gchar *fieldname);
-LL_GST_SYM(true, gst_value_get_fraction_numerator, gint, const GValue *value);
-LL_GST_SYM(true, gst_value_get_fraction_denominator, gint, const GValue *value);
-LL_GST_SYM(true, gst_structure_get_name, G_CONST_RETURN gchar *, const GstStructure *structure);
-LL_GST_SYM(true, gst_element_seek, bool, GstElement *, gdouble, GstFormat, GstSeekFlags, GstSeekType, gint64, GstSeekType, gint64);
-
-// optional symbols to grab
-LL_GST_SYM(false, gst_registry_fork_set_enabled, void, gboolean enabled);
-LL_GST_SYM(false, gst_segtrap_set_enabled, void, gboolean enabled);
-LL_GST_SYM(false, gst_message_parse_buffering, void, GstMessage *message, gint *percent);
-LL_GST_SYM(false, gst_message_parse_info, void, GstMessage *message, GError **gerror, gchar **debug);
-LL_GST_SYM(false, gst_element_query_position, gboolean, GstElement *element, GstFormat *format, gint64 *cur);
-LL_GST_SYM(false, gst_version, void, guint *major, guint *minor, guint *micro, guint *nano);
-
-// GStreamer 'internal' symbols which may not be visible in some runtimes but are still used in expanded GStreamer header macros - yuck! We'll substitute our own stubs for these.
-//LL_GST_SYM(true, _gst_debug_register_funcptr, void, GstDebugFuncPtr func, gchar* ptrname);
-//LL_GST_SYM(true, _gst_debug_category_new, GstDebugCategory *, gchar *name, guint color, gchar *description);
diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms_rawv.inc b/indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms_rawv.inc
deleted file mode 100644
index 14fbcb48b9..0000000000
--- a/indra/media_plugins/gstreamer010/llmediaimplgstreamer_syms_rawv.inc
+++ /dev/null
@@ -1,5 +0,0 @@
-
-// required symbols to grab
-LL_GST_SYM(true, gst_video_sink_get_type, GType, void);
-
-// optional symbols to grab
diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h b/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h
deleted file mode 100644
index 43ebad6744..0000000000
--- a/indra/media_plugins/gstreamer010/llmediaimplgstreamertriviallogging.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * @file llmediaimplgstreamertriviallogging.h
- * @brief minimal logging utilities.
- *
- * @cond
- * $LicenseInfo:firstyear=2009&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- * @endcond
- */
-
-#ifndef __LLMEDIAIMPLGSTREAMERTRIVIALLOGGING_H__
-#define __LLMEDIAIMPLGSTREAMERTRIVIALLOGGING_H__
-
-#include <cstdio>
-
-extern "C" {
-#include <sys/types.h>
-#include <unistd.h>
-}
-
-/////////////////////////////////////////////////////////////////////////
-// Debug/Info/Warning macros.
-#define MSGMODULEFOO "(media plugin)"
-#define STDERRMSG(...) do{\
- fprintf(stderr, " pid:%d: ", (int)getpid());\
- fprintf(stderr, MSGMODULEFOO " %s:%d: ", __FUNCTION__, __LINE__);\
- fprintf(stderr, __VA_ARGS__);\
- fputc('\n',stderr);\
- }while(0)
-#define NULLMSG(...) do{}while(0)
-
-#define DEBUGMSG NULLMSG
-#define INFOMSG STDERRMSG
-#define WARNMSG STDERRMSG
-/////////////////////////////////////////////////////////////////////////
-
-#endif /* __LLMEDIAIMPLGSTREAMERTRIVIALLOGGING_H__ */
diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp b/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp
deleted file mode 100644
index acec0f2399..0000000000
--- a/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp
+++ /dev/null
@@ -1,526 +0,0 @@
-/**
- * @file llmediaimplgstreamervidplug.h
- * @brief Video-consuming static GStreamer plugin for gst-to-LLMediaImpl
- *
- * @cond
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- * @endcond
- */
-
-#if LL_GSTREAMER010_ENABLED
-
-#include "linden_common.h"
-
-#include <gst/gst.h>
-#include <gst/video/video.h>
-#include <gst/video/gstvideosink.h>
-
-#include "llmediaimplgstreamer_syms.h"
-#include "llmediaimplgstreamertriviallogging.h"
-
-#include "llmediaimplgstreamervidplug.h"
-
-
-GST_DEBUG_CATEGORY_STATIC (gst_slvideo_debug);
-#define GST_CAT_DEFAULT gst_slvideo_debug
-
-
-#define SLV_SIZECAPS ", width=(int)[1,2048], height=(int)[1,2048] "
-#define SLV_ALLCAPS GST_VIDEO_CAPS_RGBx SLV_SIZECAPS
-
-static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE (
- (gchar*)"sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS (SLV_ALLCAPS)
- );
-
-GST_BOILERPLATE (GstSLVideo, gst_slvideo, GstVideoSink,
- GST_TYPE_VIDEO_SINK);
-
-static void gst_slvideo_set_property (GObject * object, guint prop_id,
- const GValue * value,
- GParamSpec * pspec);
-static void gst_slvideo_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec);
-
-static void
-gst_slvideo_base_init (gpointer gclass)
-{
- static GstElementDetails element_details = {
- (gchar*)"PluginTemplate",
- (gchar*)"Generic/PluginTemplate",
- (gchar*)"Generic Template Element",
- (gchar*)"Linden Lab"
- };
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- llgst_element_class_add_pad_template (element_class,
- llgst_static_pad_template_get (&sink_factory));
- llgst_element_class_set_details (element_class, &element_details);
-}
-
-
-static void
-gst_slvideo_finalize (GObject * object)
-{
- GstSLVideo *slvideo;
- slvideo = GST_SLVIDEO (object);
- if (slvideo->caps)
- {
- llgst_caps_unref(slvideo->caps);
- }
-
- G_OBJECT_CLASS(parent_class)->finalize (object);
-}
-
-
-static GstFlowReturn
-gst_slvideo_show_frame (GstBaseSink * bsink, GstBuffer * buf)
-{
- GstSLVideo *slvideo;
- llg_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
-
- slvideo = GST_SLVIDEO(bsink);
-
- DEBUGMSG("transferring a frame of %dx%d <- %p (%d)",
- slvideo->width, slvideo->height, GST_BUFFER_DATA(buf),
- slvideo->format);
-
- if (GST_BUFFER_DATA(buf))
- {
- // copy frame and frame info into neutral territory
- GST_OBJECT_LOCK(slvideo);
- slvideo->retained_frame_ready = TRUE;
- slvideo->retained_frame_width = slvideo->width;
- slvideo->retained_frame_height = slvideo->height;
- slvideo->retained_frame_format = slvideo->format;
- int rowbytes =
- SLVPixelFormatBytes[slvideo->retained_frame_format] *
- slvideo->retained_frame_width;
- int needbytes = rowbytes * slvideo->retained_frame_width;
- // resize retained frame hunk only if necessary
- if (needbytes != slvideo->retained_frame_allocbytes)
- {
- delete[] slvideo->retained_frame_data;
- slvideo->retained_frame_data = new unsigned char[needbytes];
- slvideo->retained_frame_allocbytes = needbytes;
-
- }
- // copy the actual frame data to neutral territory -
- // flipped, for GL reasons
- for (int ypos=0; ypos<slvideo->height; ++ypos)
- {
- memcpy(&slvideo->retained_frame_data[(slvideo->height-1-ypos)*rowbytes],
- &(((unsigned char*)GST_BUFFER_DATA(buf))[ypos*rowbytes]),
- rowbytes);
- }
- // done with the shared data
- GST_OBJECT_UNLOCK(slvideo);
- }
-
- return GST_FLOW_OK;
-}
-
-
-static GstStateChangeReturn
-gst_slvideo_change_state(GstElement * element, GstStateChange transition)
-{
- GstSLVideo *slvideo;
- GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
-
- slvideo = GST_SLVIDEO (element);
-
- switch (transition) {
- case GST_STATE_CHANGE_NULL_TO_READY:
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
- break;
- default:
- break;
- }
-
- ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- if (ret == GST_STATE_CHANGE_FAILURE)
- return ret;
-
- switch (transition) {
- case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
- break;
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- slvideo->fps_n = 0;
- slvideo->fps_d = 1;
- GST_VIDEO_SINK_WIDTH(slvideo) = 0;
- GST_VIDEO_SINK_HEIGHT(slvideo) = 0;
- break;
- case GST_STATE_CHANGE_READY_TO_NULL:
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-
-static GstCaps *
-gst_slvideo_get_caps (GstBaseSink * bsink)
-{
- GstSLVideo *slvideo;
- slvideo = GST_SLVIDEO(bsink);
-
- return llgst_caps_ref (slvideo->caps);
-}
-
-
-/* this function handles the link with other elements */
-static gboolean
-gst_slvideo_set_caps (GstBaseSink * bsink, GstCaps * caps)
-{
- GstSLVideo *filter;
- GstStructure *structure;
-
- GST_DEBUG ("set caps with %" GST_PTR_FORMAT, caps);
-
- filter = GST_SLVIDEO(bsink);
-
- int width, height;
- gboolean ret;
- const GValue *fps;
- const GValue *par;
- structure = llgst_caps_get_structure (caps, 0);
- ret = llgst_structure_get_int (structure, "width", &width);
- ret = ret && llgst_structure_get_int (structure, "height", &height);
- fps = llgst_structure_get_value (structure, "framerate");
- ret = ret && (fps != NULL);
- par = llgst_structure_get_value (structure, "pixel-aspect-ratio");
- if (!ret)
- return FALSE;
-
- INFOMSG("** filter caps set with width=%d, height=%d", width, height);
-
- GST_OBJECT_LOCK(filter);
-
- filter->width = width;
- filter->height = height;
-
- filter->fps_n = llgst_value_get_fraction_numerator(fps);
- filter->fps_d = llgst_value_get_fraction_denominator(fps);
- if (par)
- {
- filter->par_n = llgst_value_get_fraction_numerator(par);
- filter->par_d = llgst_value_get_fraction_denominator(par);
- }
- else
- {
- filter->par_n = 1;
- filter->par_d = 1;
- }
- GST_VIDEO_SINK_WIDTH(filter) = width;
- GST_VIDEO_SINK_HEIGHT(filter) = height;
-
- // crufty lump - we *always* accept *only* RGBX now.
- /*
- filter->format = SLV_PF_UNKNOWN;
- if (0 == strcmp(llgst_structure_get_name(structure),
- "video/x-raw-rgb"))
- {
- int red_mask;
- int green_mask;
- int blue_mask;
- llgst_structure_get_int(structure, "red_mask", &red_mask);
- llgst_structure_get_int(structure, "green_mask", &green_mask);
- llgst_structure_get_int(structure, "blue_mask", &blue_mask);
- if ((unsigned int)red_mask == 0xFF000000 &&
- (unsigned int)green_mask == 0x00FF0000 &&
- (unsigned int)blue_mask == 0x0000FF00)
- {
- filter->format = SLV_PF_RGBX;
- //fprintf(stderr, "\n\nPIXEL FORMAT RGB\n\n");
- } else if ((unsigned int)red_mask == 0x0000FF00 &&
- (unsigned int)green_mask == 0x00FF0000 &&
- (unsigned int)blue_mask == 0xFF000000)
- {
- filter->format = SLV_PF_BGRX;
- //fprintf(stderr, "\n\nPIXEL FORMAT BGR\n\n");
- }
- }*/
-
- filter->format = SLV_PF_RGBX;
-
- GST_OBJECT_UNLOCK(filter);
-
- return TRUE;
-}
-
-
-static gboolean
-gst_slvideo_start (GstBaseSink * bsink)
-{
- gboolean ret = TRUE;
-
- GST_SLVIDEO(bsink);
-
- return ret;
-}
-
-static gboolean
-gst_slvideo_stop (GstBaseSink * bsink)
-{
- GstSLVideo *slvideo;
- slvideo = GST_SLVIDEO(bsink);
-
- // free-up retained frame buffer
- GST_OBJECT_LOCK(slvideo);
- slvideo->retained_frame_ready = FALSE;
- delete[] slvideo->retained_frame_data;
- slvideo->retained_frame_data = NULL;
- slvideo->retained_frame_allocbytes = 0;
- GST_OBJECT_UNLOCK(slvideo);
-
- return TRUE;
-}
-
-
-static GstFlowReturn
-gst_slvideo_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
- GstCaps * caps, GstBuffer ** buf)
-{
- gint width, height;
- GstStructure *structure = NULL;
- GstSLVideo *slvideo;
- slvideo = GST_SLVIDEO(bsink);
-
- // caps == requested caps
- // we can ignore these and reverse-negotiate our preferred dimensions with
- // the peer if we like - we need to do this to obey dynamic resize requests
- // flowing in from the app.
- structure = llgst_caps_get_structure (caps, 0);
- if (!llgst_structure_get_int(structure, "width", &width) ||
- !llgst_structure_get_int(structure, "height", &height))
- {
- GST_WARNING_OBJECT (slvideo, "no width/height in caps %" GST_PTR_FORMAT, caps);
- return GST_FLOW_NOT_NEGOTIATED;
- }
-
- GstBuffer *newbuf = llgst_buffer_new();
- bool made_bufferdata_ptr = false;
-#define MAXDEPTHHACK 4
-
- GST_OBJECT_LOCK(slvideo);
- if (slvideo->resize_forced_always) // app is giving us a fixed size to work with
- {
- gint slwantwidth, slwantheight;
- slwantwidth = slvideo->resize_try_width;
- slwantheight = slvideo->resize_try_height;
-
- if (slwantwidth != width ||
- slwantheight != height)
- {
- // don't like requested caps, we will issue our own suggestion - copy
- // the requested caps but substitute our own width and height and see
- // if our peer is happy with that.
-
- GstCaps *desired_caps;
- GstStructure *desired_struct;
- desired_caps = llgst_caps_copy (caps);
- desired_struct = llgst_caps_get_structure (desired_caps, 0);
-
- GValue value = {0};
- g_value_init(&value, G_TYPE_INT);
- g_value_set_int(&value, slwantwidth);
- llgst_structure_set_value (desired_struct, "width", &value);
- g_value_unset(&value);
- g_value_init(&value, G_TYPE_INT);
- g_value_set_int(&value, slwantheight);
- llgst_structure_set_value (desired_struct, "height", &value);
-
- if (llgst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (slvideo),
- desired_caps))
- {
- // todo: re-use buffers from a pool?
- // todo: set MALLOCDATA to null, set DATA to point straight to shm?
-
- // peer likes our cap suggestion
- DEBUGMSG("peer loves us :)");
- GST_BUFFER_SIZE(newbuf) = slwantwidth * slwantheight * MAXDEPTHHACK;
- GST_BUFFER_MALLOCDATA(newbuf) = (guint8*)g_malloc(GST_BUFFER_SIZE(newbuf));
- GST_BUFFER_DATA(newbuf) = GST_BUFFER_MALLOCDATA(newbuf);
- llgst_buffer_set_caps (GST_BUFFER_CAST(newbuf), desired_caps);
-
- made_bufferdata_ptr = true;
- } else {
- // peer hates our cap suggestion
- INFOMSG("peer hates us :(");
- llgst_caps_unref(desired_caps);
- }
- }
- }
-
- GST_OBJECT_UNLOCK(slvideo);
-
- if (!made_bufferdata_ptr) // need to fallback to malloc at original size
- {
- GST_BUFFER_SIZE(newbuf) = width * height * MAXDEPTHHACK;
- GST_BUFFER_MALLOCDATA(newbuf) = (guint8*)g_malloc(GST_BUFFER_SIZE(newbuf));
- GST_BUFFER_DATA(newbuf) = GST_BUFFER_MALLOCDATA(newbuf);
- llgst_buffer_set_caps (GST_BUFFER_CAST(newbuf), caps);
- }
-
- *buf = GST_BUFFER_CAST(newbuf);
-
- return GST_FLOW_OK;
-}
-
-
-/* initialize the plugin's class */
-static void
-gst_slvideo_class_init (GstSLVideoClass * klass)
-{
- GObjectClass *gobject_class;
- GstElementClass *gstelement_class;
- GstBaseSinkClass *gstbasesink_class;
-
- gobject_class = (GObjectClass *) klass;
- gstelement_class = (GstElementClass *) klass;
- gstbasesink_class = (GstBaseSinkClass *) klass;
-
- gobject_class->finalize = gst_slvideo_finalize;
- gobject_class->set_property = gst_slvideo_set_property;
- gobject_class->get_property = gst_slvideo_get_property;
-
- gstelement_class->change_state = gst_slvideo_change_state;
-
-#define LLGST_DEBUG_FUNCPTR(p) (p)
- gstbasesink_class->get_caps = LLGST_DEBUG_FUNCPTR (gst_slvideo_get_caps);
- gstbasesink_class->set_caps = LLGST_DEBUG_FUNCPTR( gst_slvideo_set_caps);
- gstbasesink_class->buffer_alloc=LLGST_DEBUG_FUNCPTR(gst_slvideo_buffer_alloc);
- //gstbasesink_class->get_times = LLGST_DEBUG_FUNCPTR (gst_slvideo_get_times);
- gstbasesink_class->preroll = LLGST_DEBUG_FUNCPTR (gst_slvideo_show_frame);
- gstbasesink_class->render = LLGST_DEBUG_FUNCPTR (gst_slvideo_show_frame);
-
- gstbasesink_class->start = LLGST_DEBUG_FUNCPTR (gst_slvideo_start);
- gstbasesink_class->stop = LLGST_DEBUG_FUNCPTR (gst_slvideo_stop);
-
- // gstbasesink_class->unlock = LLGST_DEBUG_FUNCPTR (gst_slvideo_unlock);
-#undef LLGST_DEBUG_FUNCPTR
-}
-
-
-/* initialize the new element
- * instantiate pads and add them to element
- * set functions
- * initialize structure
- */
-static void
-gst_slvideo_init (GstSLVideo * filter,
- GstSLVideoClass * gclass)
-{
- filter->caps = NULL;
- filter->width = -1;
- filter->height = -1;
-
- // this is the info we share with the client app
- GST_OBJECT_LOCK(filter);
- filter->retained_frame_ready = FALSE;
- filter->retained_frame_data = NULL;
- filter->retained_frame_allocbytes = 0;
- filter->retained_frame_width = filter->width;
- filter->retained_frame_height = filter->height;
- filter->retained_frame_format = SLV_PF_UNKNOWN;
- GstCaps *caps = llgst_caps_from_string (SLV_ALLCAPS);
- llgst_caps_replace (&filter->caps, caps);
- filter->resize_forced_always = false;
- filter->resize_try_width = -1;
- filter->resize_try_height = -1;
- GST_OBJECT_UNLOCK(filter);
-}
-
-static void
-gst_slvideo_set_property (GObject * object, guint prop_id,
- const GValue * value, GParamSpec * pspec)
-{
- llg_return_if_fail (GST_IS_SLVIDEO (object));
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gst_slvideo_get_property (GObject * object, guint prop_id,
- GValue * value, GParamSpec * pspec)
-{
- llg_return_if_fail (GST_IS_SLVIDEO (object));
-
- switch (prop_id) {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-
-/* entry point to initialize the plug-in
- * initialize the plug-in itself
- * register the element factories and pad templates
- * register the features
- */
-static gboolean
-plugin_init (GstPlugin * plugin)
-{
- DEBUGMSG("PLUGIN INIT");
-
- GST_DEBUG_CATEGORY_INIT (gst_slvideo_debug, (gchar*)"private-slvideo-plugin",
- 0, (gchar*)"Second Life Video Sink");
-
- return llgst_element_register (plugin, "private-slvideo",
- GST_RANK_NONE, GST_TYPE_SLVIDEO);
-}
-
-/* this is the structure that gstreamer looks for to register plugins
- */
-/* NOTE: Can't rely upon GST_PLUGIN_DEFINE_STATIC to self-register, since
- some g++ versions buggily avoid __attribute__((constructor)) functions -
- so we provide an explicit plugin init function.
- */
-#define PACKAGE (gchar*)"packagehack"
-// this macro quietly refers to PACKAGE internally
-GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- (gchar*)"private-slvideoplugin",
- (gchar*)"SL Video sink plugin",
- plugin_init, (gchar*)"1.0", (gchar*)"LGPL",
- (gchar*)"Second Life",
- (gchar*)"http://www.secondlife.com/");
-#undef PACKAGE
-void gst_slvideo_init_class (void)
-{
- ll_gst_plugin_register_static (&gst_plugin_desc);
- DEBUGMSG("CLASS INIT");
-}
-
-#endif // LL_GSTREAMER010_ENABLED
diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h b/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h
deleted file mode 100644
index d4e07daf4f..0000000000
--- a/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
- * @file llmediaimplgstreamervidplug.h
- * @brief Video-consuming static GStreamer plugin for gst-to-LLMediaImpl
- *
- * @cond
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- * @endcond
- */
-
-#ifndef __GST_SLVIDEO_H__
-#define __GST_SLVIDEO_H__
-
-#if LL_GSTREAMER010_ENABLED
-
-extern "C" {
-#include <gst/gst.h>
-#include <gst/video/video.h>
-#include <gst/video/gstvideosink.h>
-}
-
-G_BEGIN_DECLS
-
-/* #defines don't like whitespacey bits */
-#define GST_TYPE_SLVIDEO \
- (gst_slvideo_get_type())
-#define GST_SLVIDEO(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SLVIDEO,GstSLVideo))
-#define GST_SLVIDEO_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SLVIDEO,GstSLVideoClass))
-#define GST_IS_SLVIDEO(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SLVIDEO))
-#define GST_IS_SLVIDEO_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SLVIDEO))
-
-typedef struct _GstSLVideo GstSLVideo;
-typedef struct _GstSLVideoClass GstSLVideoClass;
-
-typedef enum {
- SLV_PF_UNKNOWN = 0,
- SLV_PF_RGBX = 1,
- SLV_PF_BGRX = 2,
- SLV__END = 3
-} SLVPixelFormat;
-const int SLVPixelFormatBytes[SLV__END] = {1, 4, 4};
-
-struct _GstSLVideo
-{
- GstVideoSink video_sink;
-
- GstCaps *caps;
-
- int fps_n, fps_d;
- int par_n, par_d;
- int height, width;
- SLVPixelFormat format;
-
- // SHARED WITH APPLICATION:
- // Access to the following should be protected by GST_OBJECT_LOCK() on
- // the GstSLVideo object, and should be totally consistent upon UNLOCK
- // (i.e. all written at once to reflect the current retained frame info
- // when the retained frame is updated.)
- bool retained_frame_ready; // new frame ready since flag last reset. (*TODO: could get the writer to wait on a semaphore instead of having the reader poll, potentially making dropped frames somewhat cheaper.)
- unsigned char* retained_frame_data;
- int retained_frame_allocbytes;
- int retained_frame_width, retained_frame_height;
- SLVPixelFormat retained_frame_format;
- // sticky resize info
- bool resize_forced_always;
- int resize_try_width;
- int resize_try_height;
-};
-
-struct _GstSLVideoClass
-{
- GstVideoSinkClass parent_class;
-};
-
-GType gst_slvideo_get_type (void);
-
-void gst_slvideo_init_class (void);
-
-G_END_DECLS
-
-#endif // LL_GSTREAMER010_ENABLED
-
-#endif /* __GST_SLVIDEO_H__ */
diff --git a/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp b/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp
deleted file mode 100644
index 97d1d7d7b5..0000000000
--- a/indra/media_plugins/gstreamer010/media_plugin_gstreamer010.cpp
+++ /dev/null
@@ -1,1266 +0,0 @@
-/**
- * @file media_plugin_gstreamer010.cpp
- * @brief GStreamer-0.10 plugin for LLMedia API plugin system
- *
- * @cond
- * $LicenseInfo:firstyear=2007&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- * @endcond
- */
-
-#include "linden_common.h"
-
-#include "llgl.h"
-
-#include "llplugininstance.h"
-#include "llpluginmessage.h"
-#include "llpluginmessageclasses.h"
-#include "media_plugin_base.h"
-
-#if LL_GSTREAMER010_ENABLED
-
-extern "C" {
-#include <gst/gst.h>
-}
-
-#include "llmediaimplgstreamer.h"
-#include "llmediaimplgstreamertriviallogging.h"
-
-#include "llmediaimplgstreamervidplug.h"
-
-#include "llmediaimplgstreamer_syms.h"
-
-//////////////////////////////////////////////////////////////////////////////
-//
-class MediaPluginGStreamer010 : public MediaPluginBase
-{
-public:
- MediaPluginGStreamer010(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data);
- ~MediaPluginGStreamer010();
-
- /* virtual */ void receiveMessage(const char *message_string);
-
- static bool startup();
- static bool closedown();
-
- gboolean processGSTEvents(GstBus *bus,
- GstMessage *message);
-
-private:
- std::string getVersion();
- bool navigateTo( const std::string urlIn );
- bool seek( double time_sec );
- bool setVolume( float volume );
-
- // misc
- bool pause();
- bool stop();
- bool play(double rate);
- bool getTimePos(double &sec_out);
-
- static const double MIN_LOOP_SEC = 1.0F;
-
- bool mIsLooping;
-
- enum ECommand {
- COMMAND_NONE,
- COMMAND_STOP,
- COMMAND_PLAY,
- COMMAND_FAST_FORWARD,
- COMMAND_FAST_REWIND,
- COMMAND_PAUSE,
- COMMAND_SEEK,
- };
- ECommand mCommand;
-
-private:
- bool unload();
- bool load();
-
- bool update(int milliseconds);
- void mouseDown( int x, int y );
- void mouseUp( int x, int y );
- void mouseMove( int x, int y );
-
- void sizeChanged();
-
- static bool mDoneInit;
-
- guint mBusWatchID;
-
- float mVolume;
-
- int mDepth;
-
- // media NATURAL size
- int mNaturalWidth;
- int mNaturalHeight;
- // media current size
- int mCurrentWidth;
- int mCurrentHeight;
- int mCurrentRowbytes;
- // previous media size so we can detect changes
- int mPreviousWidth;
- int mPreviousHeight;
- // desired render size from host
- int mWidth;
- int mHeight;
- // padded texture size we need to write into
- int mTextureWidth;
- int mTextureHeight;
-
- int mTextureFormatPrimary;
- int mTextureFormatType;
-
- bool mSeekWanted;
- double mSeekDestination;
-
- // Very GStreamer-specific
- GMainLoop *mPump; // event pump for this media
- GstElement *mPlaybin;
- GstElement *mVisualizer;
- GstSLVideo *mVideoSink;
-};
-
-//static
-bool MediaPluginGStreamer010::mDoneInit = false;
-
-MediaPluginGStreamer010::MediaPluginGStreamer010(
- LLPluginInstance::sendMessageFunction host_send_func,
- void *host_user_data ) :
- MediaPluginBase(host_send_func, host_user_data),
- mBusWatchID ( 0 ),
- mCurrentRowbytes ( 4 ),
- mTextureFormatPrimary ( GL_RGBA ),
- mTextureFormatType ( GL_UNSIGNED_INT_8_8_8_8_REV ),
- mSeekWanted(false),
- mSeekDestination(0.0),
- mPump ( NULL ),
- mPlaybin ( NULL ),
- mVisualizer ( NULL ),
- mVideoSink ( NULL ),
- mCommand ( COMMAND_NONE )
-{
- std::ostringstream str;
- INFOMSG("MediaPluginGStreamer010 constructor - my PID=%u", U32(getpid()));
-}
-
-///////////////////////////////////////////////////////////////////////////////
-//
-//#define LL_GST_REPORT_STATE_CHANGES
-#ifdef LL_GST_REPORT_STATE_CHANGES
-static char* get_gst_state_name(GstState state)
-{
- switch (state) {
- case GST_STATE_VOID_PENDING: return "VOID_PENDING";
- case GST_STATE_NULL: return "NULL";
- case GST_STATE_READY: return "READY";
- case GST_STATE_PAUSED: return "PAUSED";
- case GST_STATE_PLAYING: return "PLAYING";
- }
- return "(unknown)";
-}
-#endif // LL_GST_REPORT_STATE_CHANGES
-
-gboolean
-MediaPluginGStreamer010::processGSTEvents(GstBus *bus,
- GstMessage *message)
-{
- if (!message)
- return TRUE; // shield against GStreamer bug
-
- if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_STATE_CHANGED &&
- GST_MESSAGE_TYPE(message) != GST_MESSAGE_BUFFERING)
- {
- DEBUGMSG("Got GST message type: %s",
- LLGST_MESSAGE_TYPE_NAME (message));
- }
- else
- {
- // TODO: grok 'duration' message type
- DEBUGMSG("Got GST message type: %s",
- LLGST_MESSAGE_TYPE_NAME (message));
- }
-
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_BUFFERING: {
- // NEEDS GST 0.10.11+
- if (llgst_message_parse_buffering)
- {
- gint percent = 0;
- llgst_message_parse_buffering(message, &percent);
- DEBUGMSG("GST buffering: %d%%", percent);
- }
- break;
- }
- case GST_MESSAGE_STATE_CHANGED: {
- GstState old_state;
- GstState new_state;
- GstState pending_state;
- llgst_message_parse_state_changed(message,
- &old_state,
- &new_state,
- &pending_state);
-#ifdef LL_GST_REPORT_STATE_CHANGES
- // not generally very useful, and rather spammy.
- DEBUGMSG("state change (old,<new>,pending): %s,<%s>,%s",
- get_gst_state_name(old_state),
- get_gst_state_name(new_state),
- get_gst_state_name(pending_state));
-#endif // LL_GST_REPORT_STATE_CHANGES
-
- switch (new_state) {
- case GST_STATE_VOID_PENDING:
- break;
- case GST_STATE_NULL:
- break;
- case GST_STATE_READY:
- setStatus(STATUS_LOADED);
- break;
- case GST_STATE_PAUSED:
- setStatus(STATUS_PAUSED);
- break;
- case GST_STATE_PLAYING:
- setStatus(STATUS_PLAYING);
- break;
- }
- break;
- }
- case GST_MESSAGE_ERROR: {
- GError *err = NULL;
- gchar *debug = NULL;
-
- llgst_message_parse_error (message, &err, &debug);
- WARNMSG("GST error: %s", err?err->message:"(unknown)");
- if (err)
- g_error_free (err);
- g_free (debug);
-
- mCommand = COMMAND_STOP;
-
- setStatus(STATUS_ERROR);
-
- break;
- }
- case GST_MESSAGE_INFO: {
- if (llgst_message_parse_info)
- {
- GError *err = NULL;
- gchar *debug = NULL;
-
- llgst_message_parse_info (message, &err, &debug);
- INFOMSG("GST info: %s", err?err->message:"(unknown)");
- if (err)
- g_error_free (err);
- g_free (debug);
- }
- break;
- }
- case GST_MESSAGE_WARNING: {
- GError *err = NULL;
- gchar *debug = NULL;
-
- llgst_message_parse_warning (message, &err, &debug);
- WARNMSG("GST warning: %s", err?err->message:"(unknown)");
- if (err)
- g_error_free (err);
- g_free (debug);
-
- break;
- }
- case GST_MESSAGE_EOS:
- /* end-of-stream */
- DEBUGMSG("GST end-of-stream.");
- if (mIsLooping)
- {
- DEBUGMSG("looping media...");
- double eos_pos_sec = 0.0F;
- bool got_eos_position = getTimePos(eos_pos_sec);
-
- if (got_eos_position && eos_pos_sec < MIN_LOOP_SEC)
- {
- // if we know that the movie is really short, don't
- // loop it else it can easily become a time-hog
- // because of GStreamer spin-up overhead
- DEBUGMSG("really short movie (%0.3fsec) - not gonna loop this, pausing instead.", eos_pos_sec);
- // inject a COMMAND_PAUSE
- mCommand = COMMAND_PAUSE;
- }
- else
- {
-#undef LLGST_LOOP_BY_SEEKING
-// loop with a stop-start instead of a seek, because it actually seems rather
-// faster than seeking on remote streams.
-#ifdef LLGST_LOOP_BY_SEEKING
- // first, try looping by an explicit rewind
- bool seeksuccess = seek(0.0);
- if (seeksuccess)
- {
- play(1.0);
- }
- else
-#endif // LLGST_LOOP_BY_SEEKING
- { // use clumsy stop-start to loop
- DEBUGMSG("didn't loop by rewinding - stopping and starting instead...");
- stop();
- play(1.0);
- }
- }
- }
- else // not a looping media
- {
- // inject a COMMAND_STOP
- mCommand = COMMAND_STOP;
- }
- break;
- default:
- /* unhandled message */
- break;
- }
-
- /* we want to be notified again the next time there is a message
- * on the bus, so return true (false means we want to stop watching
- * for messages on the bus and our callback should not be called again)
- */
- return TRUE;
-}
-
-extern "C" {
-gboolean
-llmediaimplgstreamer_bus_callback (GstBus *bus,
- GstMessage *message,
- gpointer data)
-{
- MediaPluginGStreamer010 *impl = (MediaPluginGStreamer010*)data;
- return impl->processGSTEvents(bus, message);
-}
-} // extern "C"
-
-
-
-bool
-MediaPluginGStreamer010::navigateTo ( const std::string urlIn )
-{
- if (!mDoneInit)
- return false; // error
-
- setStatus(STATUS_LOADING);
-
- DEBUGMSG("Setting media URI: %s", urlIn.c_str());
-
- mSeekWanted = false;
-
- if (NULL == mPump ||
- NULL == mPlaybin)
- {
- setStatus(STATUS_ERROR);
- return false; // error
- }
-
- // set URI
- g_object_set (G_OBJECT (mPlaybin), "uri", urlIn.c_str(), NULL);
- //g_object_set (G_OBJECT (mPlaybin), "uri", "file:///tmp/movie", NULL);
-
- // navigateTo implicitly plays, too.
- play(1.0);
-
- return true;
-}
-
-
-bool
-MediaPluginGStreamer010::update(int milliseconds)
-{
- if (!mDoneInit)
- return false; // error
-
- DEBUGMSG("updating media...");
-
- // sanity check
- if (NULL == mPump ||
- NULL == mPlaybin)
- {
- DEBUGMSG("dead media...");
- return false;
- }
-
- // see if there's an outstanding seek wanted
- if (mSeekWanted &&
- // bleh, GST has to be happy that the movie is really truly playing
- // or it may quietly ignore the seek (with rtsp:// at least).
- (GST_STATE(mPlaybin) == GST_STATE_PLAYING))
- {
- seek(mSeekDestination);
- mSeekWanted = false;
- }
-
- // *TODO: time-limit - but there isn't a lot we can do here, most
- // time is spent in gstreamer's own opaque worker-threads. maybe
- // we can do something sneaky like only unlock the video object
- // for 'milliseconds' and otherwise hold the lock.
- while (g_main_context_pending(g_main_loop_get_context(mPump)))
- {
- g_main_context_iteration(g_main_loop_get_context(mPump), FALSE);
- }
-
- // check for availability of a new frame
-
- if (mVideoSink)
- {
- GST_OBJECT_LOCK(mVideoSink);
- if (mVideoSink->retained_frame_ready)
- {
- DEBUGMSG("NEW FRAME READY");
-
- if (mVideoSink->retained_frame_width != mCurrentWidth ||
- mVideoSink->retained_frame_height != mCurrentHeight)
- // *TODO: also check for change in format
- {
- // just resize container, don't consume frame
- int neww = mVideoSink->retained_frame_width;
- int newh = mVideoSink->retained_frame_height;
-
- int newd = 4;
- mTextureFormatPrimary = GL_RGBA;
- mTextureFormatType = GL_UNSIGNED_INT_8_8_8_8_REV;
-
- /*
- int newd = SLVPixelFormatBytes[mVideoSink->retained_frame_format];
- if (SLV_PF_BGRX == mVideoSink->retained_frame_format)
- {
- mTextureFormatPrimary = GL_BGRA;
- mTextureFormatType = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
- else
- {
- mTextureFormatPrimary = GL_RGBA;
- mTextureFormatType = GL_UNSIGNED_INT_8_8_8_8_REV;
- }
- */
-
- GST_OBJECT_UNLOCK(mVideoSink);
-
- mCurrentRowbytes = neww * newd;
- DEBUGMSG("video container resized to %dx%d",
- neww, newh);
-
- mDepth = newd;
- mCurrentWidth = neww;
- mCurrentHeight = newh;
- sizeChanged();
- return true;
- }
-
- if (mPixels &&
- mCurrentHeight <= mHeight &&
- mCurrentWidth <= mWidth &&
- !mTextureSegmentName.empty())
- {
- // we're gonna totally consume this frame - reset 'ready' flag
- mVideoSink->retained_frame_ready = FALSE;
- int destination_rowbytes = mWidth * mDepth;
- for (int row=0; row<mCurrentHeight; ++row)
- {
- memcpy(&mPixels
- [destination_rowbytes * row],
- &mVideoSink->retained_frame_data
- [mCurrentRowbytes * row],
- mCurrentRowbytes);
- }
-
- GST_OBJECT_UNLOCK(mVideoSink);
- DEBUGMSG("NEW FRAME REALLY TRULY CONSUMED, TELLING HOST");
-
- setDirty(0,0,mCurrentWidth,mCurrentHeight);
- }
- else
- {
- // new frame ready, but we're not ready to
- // consume it.
-
- GST_OBJECT_UNLOCK(mVideoSink);
-
- DEBUGMSG("NEW FRAME not consumed, still waiting for a shm segment and/or shm resize");
- }
-
- return true;
- }
- else
- {
- // nothing to do yet.
- GST_OBJECT_UNLOCK(mVideoSink);
- return true;
- }
- }
-
- return true;
-}
-
-
-void
-MediaPluginGStreamer010::mouseDown( int x, int y )
-{
- // do nothing
-}
-
-void
-MediaPluginGStreamer010::mouseUp( int x, int y )
-{
- // do nothing
-}
-
-void
-MediaPluginGStreamer010::mouseMove( int x, int y )
-{
- // do nothing
-}
-
-
-bool
-MediaPluginGStreamer010::pause()
-{
- DEBUGMSG("pausing media...");
- // todo: error-check this?
- if (mDoneInit && mPlaybin)
- {
- llgst_element_set_state(mPlaybin, GST_STATE_PAUSED);
- return true;
- }
- return false;
-}
-
-bool
-MediaPluginGStreamer010::stop()
-{
- DEBUGMSG("stopping media...");
- // todo: error-check this?
- if (mDoneInit && mPlaybin)
- {
- llgst_element_set_state(mPlaybin, GST_STATE_READY);
- return true;
- }
- return false;
-}
-
-bool
-MediaPluginGStreamer010::play(double rate)
-{
- // NOTE: we don't actually support non-natural rate.
-
- DEBUGMSG("playing media... rate=%f", rate);
- // todo: error-check this?
- if (mDoneInit && mPlaybin)
- {
- llgst_element_set_state(mPlaybin, GST_STATE_PLAYING);
- return true;
- }
- return false;
-}
-
-bool
-MediaPluginGStreamer010::setVolume( float volume )
-{
- // we try to only update volume as conservatively as
- // possible, as many gst-plugins-base versions up to at least
- // November 2008 have critical race-conditions in setting volume - sigh
- if (mVolume == volume)
- return true; // nothing to do, everything's fine
-
- mVolume = volume;
- if (mDoneInit && mPlaybin)
- {
- g_object_set(mPlaybin, "volume", mVolume, NULL);
- return true;
- }
-
- return false;
-}
-
-bool
-MediaPluginGStreamer010::seek(double time_sec)
-{
- bool success = false;
- if (mDoneInit && mPlaybin)
- {
- success = llgst_element_seek(mPlaybin, 1.0F, GST_FORMAT_TIME,
- GstSeekFlags(GST_SEEK_FLAG_FLUSH |
- GST_SEEK_FLAG_KEY_UNIT),
- GST_SEEK_TYPE_SET, gint64(time_sec*GST_SECOND),
- GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
- }
- DEBUGMSG("MEDIA SEEK REQUEST to %fsec result was %d",
- float(time_sec), int(success));
- return success;
-}
-
-bool
-MediaPluginGStreamer010::getTimePos(double &sec_out)
-{
- bool got_position = false;
- if (mDoneInit && mPlaybin)
- {
- gint64 pos;
- GstFormat timefmt = GST_FORMAT_TIME;
- got_position =
- llgst_element_query_position &&
- llgst_element_query_position(mPlaybin,
- &timefmt,
- &pos);
- got_position = got_position
- && (timefmt == GST_FORMAT_TIME);
- // GStreamer may have other ideas, but we consider the current position
- // undefined if not PLAYING or PAUSED
- got_position = got_position &&
- (GST_STATE(mPlaybin) == GST_STATE_PLAYING ||
- GST_STATE(mPlaybin) == GST_STATE_PAUSED);
- if (got_position && !GST_CLOCK_TIME_IS_VALID(pos))
- {
- if (GST_STATE(mPlaybin) == GST_STATE_PLAYING)
- {
- // if we're playing then we treat an invalid clock time
- // as 0, for complicated reasons (insert reason here)
- pos = 0;
- }
- else
- {
- got_position = false;
- }
-
- }
- // If all the preconditions succeeded... we can trust the result.
- if (got_position)
- {
- sec_out = double(pos) / double(GST_SECOND); // gst to sec
- }
- }
- return got_position;
-}
-
-bool
-MediaPluginGStreamer010::load()
-{
- if (!mDoneInit)
- return false; // error
-
- setStatus(STATUS_LOADING);
-
- DEBUGMSG("setting up media...");
-
- mIsLooping = false;
- mVolume = 0.1234567; // minor hack to force an initial volume update
-
- // Create a pumpable main-loop for this media
- mPump = g_main_loop_new (NULL, FALSE);
- if (!mPump)
- {
- setStatus(STATUS_ERROR);
- return false; // error
- }
-
- // instantiate a playbin element to do the hard work
- mPlaybin = llgst_element_factory_make ("playbin", "play");
- if (!mPlaybin)
- {
- setStatus(STATUS_ERROR);
- return false; // error
- }
-
- // get playbin's bus
- GstBus *bus = llgst_pipeline_get_bus (GST_PIPELINE (mPlaybin));
- if (!bus)
- {
- setStatus(STATUS_ERROR);
- return false; // error
- }
- mBusWatchID = llgst_bus_add_watch (bus,
- llmediaimplgstreamer_bus_callback,
- this);
- llgst_object_unref (bus);
-
-#if 0 // not quite stable/correct yet
- // get a visualizer element (bonus feature!)
- char* vis_name = getenv("LL_GST_VIS_NAME");
- if (!vis_name ||
- (vis_name && std::string(vis_name)!="none"))
- {
- if (vis_name)
- {
- mVisualizer = llgst_element_factory_make (vis_name, "vis");
- }
- if (!mVisualizer)
- {
- mVisualizer = llgst_element_factory_make ("libvisual_jess", "vis");
- if (!mVisualizer)
- {
- mVisualizer = llgst_element_factory_make ("goom", "vis");
- if (!mVisualizer)
- {
- mVisualizer = llgst_element_factory_make ("libvisual_lv_scope", "vis");
- if (!mVisualizer)
- {
- // That's okay, we don't NEED this.
- }
- }
- }
- }
- }
-#endif
-
- if (NULL == getenv("LL_GSTREAMER_EXTERNAL")) {
- // instantiate a custom video sink
- mVideoSink =
- GST_SLVIDEO(llgst_element_factory_make ("private-slvideo", "slvideo"));
- if (!mVideoSink)
- {
- WARNMSG("Could not instantiate private-slvideo element.");
- // todo: cleanup.
- setStatus(STATUS_ERROR);
- return false; // error
- }
-
- // connect the pieces
- g_object_set(mPlaybin, "video-sink", mVideoSink, NULL);
- }
-
- if (mVisualizer)
- {
- g_object_set(mPlaybin, "vis-plugin", mVisualizer, NULL);
- }
-
- return true;
-}
-
-bool
-MediaPluginGStreamer010::unload ()
-{
- if (!mDoneInit)
- return false; // error
-
- DEBUGMSG("unloading media...");
-
- // stop getting callbacks for this bus
- g_source_remove(mBusWatchID);
- mBusWatchID = 0;
-
- if (mPlaybin)
- {
- llgst_element_set_state (mPlaybin, GST_STATE_NULL);
- llgst_object_unref (GST_OBJECT (mPlaybin));
- mPlaybin = NULL;
- }
-
- if (mVisualizer)
- {
- llgst_object_unref (GST_OBJECT (mVisualizer));
- mVisualizer = NULL;
- }
-
- if (mPump)
- {
- g_main_loop_quit(mPump);
- mPump = NULL;
- }
-
- mVideoSink = NULL;
-
- setStatus(STATUS_NONE);
-
- return true;
-}
-
-
-//static
-bool
-MediaPluginGStreamer010::startup()
-{
- // first - check if GStreamer is explicitly disabled
- if (NULL != getenv("LL_DISABLE_GSTREAMER"))
- return false;
-
- // only do global GStreamer initialization once.
- if (!mDoneInit)
- {
- g_thread_init(NULL);
-
- // Init the glib type system - we need it.
- g_type_init();
-
- // Get symbols!
-#if LL_DARWIN
- if (! grab_gst_syms("libgstreamer-0.10.dylib",
- "libgstvideo-0.10.dylib") )
-#elseif LL_WINDOWS
- if (! grab_gst_syms("libgstreamer-0.10.dll",
- "libgstvideo-0.10.dll") )
-#else // linux or other ELFy unixoid
- if (! grab_gst_syms("libgstreamer-0.10.so.0",
- "libgstvideo-0.10.so.0") )
-#endif
- {
- WARNMSG("Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled.");
- return false;
- }
-
- if (llgst_segtrap_set_enabled)
- {
- llgst_segtrap_set_enabled(FALSE);
- }
- else
- {
- WARNMSG("gst_segtrap_set_enabled() is not available; plugin crashes won't be caught.");
- }
-
-#if LL_LINUX
- // Gstreamer tries a fork during init, waitpid-ing on it,
- // which conflicts with any installed SIGCHLD handler...
- struct sigaction tmpact, oldact;
- if (llgst_registry_fork_set_enabled) {
- // if we can disable SIGCHLD-using forking behaviour,
- // do it.
- llgst_registry_fork_set_enabled(false);
- }
- else {
- // else temporarily install default SIGCHLD handler
- // while GStreamer initialises
- tmpact.sa_handler = SIG_DFL;
- sigemptyset( &tmpact.sa_mask );
- tmpact.sa_flags = SA_SIGINFO;
- sigaction(SIGCHLD, &tmpact, &oldact);
- }
-#endif // LL_LINUX
-
- // Protect against GStreamer resetting the locale, yuck.
- static std::string saved_locale;
- saved_locale = setlocale(LC_ALL, NULL);
-
- // finally, try to initialize GStreamer!
- GError *err = NULL;
- gboolean init_gst_success = llgst_init_check(NULL, NULL, &err);
-
- // restore old locale
- setlocale(LC_ALL, saved_locale.c_str() );
-
-#if LL_LINUX
- // restore old SIGCHLD handler
- if (!llgst_registry_fork_set_enabled)
- sigaction(SIGCHLD, &oldact, NULL);
-#endif // LL_LINUX
-
- if (!init_gst_success) // fail
- {
- if (err)
- {
- WARNMSG("GST init failed: %s", err->message);
- g_error_free(err);
- }
- else
- {
- WARNMSG("GST init failed for unspecified reason.");
- }
- return false;
- }
-
- // Init our custom plugins - only really need do this once.
- gst_slvideo_init_class();
-
- mDoneInit = true;
- }
-
- return true;
-}
-
-
-void
-MediaPluginGStreamer010::sizeChanged()
-{
- // the shared writing space has possibly changed size/location/whatever
-
- // Check to see whether the movie's NATURAL size has been set yet
- if (1 == mNaturalWidth &&
- 1 == mNaturalHeight)
- {
- mNaturalWidth = mCurrentWidth;
- mNaturalHeight = mCurrentHeight;
- DEBUGMSG("Media NATURAL size better detected as %dx%d",
- mNaturalWidth, mNaturalHeight);
- }
-
- // if the size has changed then the shm has changed and the app needs telling
- if (mCurrentWidth != mPreviousWidth ||
- mCurrentHeight != mPreviousHeight)
- {
- mPreviousWidth = mCurrentWidth;
- mPreviousHeight = mCurrentHeight;
-
- LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_request");
- message.setValue("name", mTextureSegmentName);
- message.setValueS32("width", mNaturalWidth);
- message.setValueS32("height", mNaturalHeight);
- DEBUGMSG("<--- Sending size change request to application with name: '%s' - natural size is %d x %d", mTextureSegmentName.c_str(), mNaturalWidth, mNaturalHeight);
- sendMessage(message);
- }
-}
-
-
-
-//static
-bool
-MediaPluginGStreamer010::closedown()
-{
- if (!mDoneInit)
- return false; // error
-
- ungrab_gst_syms();
-
- mDoneInit = false;
-
- return true;
-}
-
-MediaPluginGStreamer010::~MediaPluginGStreamer010()
-{
- DEBUGMSG("MediaPluginGStreamer010 destructor");
-
- closedown();
-
- DEBUGMSG("GStreamer010 closing down");
-}
-
-
-std::string
-MediaPluginGStreamer010::getVersion()
-{
- std::string plugin_version = "GStreamer010 media plugin, GStreamer version ";
- if (mDoneInit &&
- llgst_version)
- {
- guint major, minor, micro, nano;
- llgst_version(&major, &minor, &micro, &nano);
- plugin_version += llformat("%u.%u.%u.%u (runtime), %u.%u.%u.%u (headers)", (unsigned int)major, (unsigned int)minor, (unsigned int)micro, (unsigned int)nano, (unsigned int)GST_VERSION_MAJOR, (unsigned int)GST_VERSION_MINOR, (unsigned int)GST_VERSION_MICRO, (unsigned int)GST_VERSION_NANO);
- }
- else
- {
- plugin_version += "(unknown)";
- }
- return plugin_version;
-}
-
-void MediaPluginGStreamer010::receiveMessage(const char *message_string)
-{
- //std::cerr << "MediaPluginGStreamer010::receiveMessage: received message: \"" << message_string << "\"" << std::endl;
-
- LLPluginMessage message_in;
-
- if(message_in.parse(message_string) >= 0)
- {
- std::string message_class = message_in.getClass();
- std::string message_name = message_in.getName();
- if(message_class == LLPLUGIN_MESSAGE_CLASS_BASE)
- {
- if(message_name == "init")
- {
- LLPluginMessage message("base", "init_response");
- LLSD versions = LLSD::emptyMap();
- versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION;
- versions[LLPLUGIN_MESSAGE_CLASS_MEDIA] = LLPLUGIN_MESSAGE_CLASS_MEDIA_VERSION;
- versions[LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME] = LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME_VERSION;
- message.setValueLLSD("versions", versions);
-
- if ( load() )
- {
- DEBUGMSG("GStreamer010 media instance set up");
- }
- else
- {
- WARNMSG("GStreamer010 media instance failed to set up");
- }
-
- message.setValue("plugin_version", getVersion());
- sendMessage(message);
- }
- else if(message_name == "idle")
- {
- // no response is necessary here.
- double time = message_in.getValueReal("time");
-
- // Convert time to milliseconds for update()
- update((int)(time * 1000.0f));
- }
- else if(message_name == "cleanup")
- {
- unload();
- closedown();
- }
- else if(message_name == "shm_added")
- {
- SharedSegmentInfo info;
- info.mAddress = message_in.getValuePointer("address");
- info.mSize = (size_t)message_in.getValueS32("size");
- std::string name = message_in.getValue("name");
-
- std::ostringstream str;
- INFOMSG("MediaPluginGStreamer010::receiveMessage: shared memory added, name: %s, size: %d, address: %p", name.c_str(), int(info.mSize), info.mAddress);
-
- mSharedSegments.insert(SharedSegmentMap::value_type(name, info));
- }
- else if(message_name == "shm_remove")
- {
- std::string name = message_in.getValue("name");
-
- DEBUGMSG("MediaPluginGStreamer010::receiveMessage: shared memory remove, name = %s", name.c_str());
-
- SharedSegmentMap::iterator iter = mSharedSegments.find(name);
- if(iter != mSharedSegments.end())
- {
- if(mPixels == iter->second.mAddress)
- {
- // This is the currently active pixel buffer. Make sure we stop drawing to it.
- mPixels = NULL;
- mTextureSegmentName.clear();
-
- // Make sure the movie decoder is no longer pointed at the shared segment.
- sizeChanged();
- }
- mSharedSegments.erase(iter);
- }
- else
- {
- WARNMSG("MediaPluginGStreamer010::receiveMessage: unknown shared memory region!");
- }
-
- // Send the response so it can be cleaned up.
- LLPluginMessage message("base", "shm_remove_response");
- message.setValue("name", name);
- sendMessage(message);
- }
- else
- {
- std::ostringstream str;
- INFOMSG("MediaPluginGStreamer010::receiveMessage: unknown base message: %s", message_name.c_str());
- }
- }
- else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA)
- {
- if(message_name == "init")
- {
- // Plugin gets to decide the texture parameters to use.
- LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "texture_params");
- // lame to have to decide this now, it depends on the movie. Oh well.
- mDepth = 4;
-
- mCurrentWidth = 1;
- mCurrentHeight = 1;
- mPreviousWidth = 1;
- mPreviousHeight = 1;
- mNaturalWidth = 1;
- mNaturalHeight = 1;
- mWidth = 1;
- mHeight = 1;
- mTextureWidth = 1;
- mTextureHeight = 1;
-
- message.setValueU32("format", GL_RGBA);
- message.setValueU32("type", GL_UNSIGNED_INT_8_8_8_8_REV);
-
- message.setValueS32("depth", mDepth);
- message.setValueS32("default_width", mWidth);
- message.setValueS32("default_height", mHeight);
- message.setValueU32("internalformat", GL_RGBA8);
- message.setValueBoolean("coords_opengl", true); // true == use OpenGL-style coordinates, false == (0,0) is upper left.
- message.setValueBoolean("allow_downsample", true); // we respond with grace and performance if asked to downscale
- sendMessage(message);
- }
- else if(message_name == "size_change")
- {
- std::string name = message_in.getValue("name");
- S32 width = message_in.getValueS32("width");
- S32 height = message_in.getValueS32("height");
- S32 texture_width = message_in.getValueS32("texture_width");
- S32 texture_height = message_in.getValueS32("texture_height");
-
- std::ostringstream str;
- INFOMSG("---->Got size change instruction from application with shm name: %s - size is %d x %d", name.c_str(), width, height);
-
- LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response");
- message.setValue("name", name);
- message.setValueS32("width", width);
- message.setValueS32("height", height);
- message.setValueS32("texture_width", texture_width);
- message.setValueS32("texture_height", texture_height);
- sendMessage(message);
-
- if(!name.empty())
- {
- // Find the shared memory region with this name
- SharedSegmentMap::iterator iter = mSharedSegments.find(name);
- if(iter != mSharedSegments.end())
- {
- INFOMSG("*** Got size change with matching shm, new size is %d x %d", width, height);
- INFOMSG("*** Got size change with matching shm, texture size size is %d x %d", texture_width, texture_height);
-
- mPixels = (unsigned char*)iter->second.mAddress;
- mTextureSegmentName = name;
- mWidth = width;
- mHeight = height;
-
- if (texture_width > 1 ||
- texture_height > 1) // not a dummy size from the app, a real explicit forced size
- {
- INFOMSG("**** = REAL RESIZE REQUEST FROM APP");
-
- GST_OBJECT_LOCK(mVideoSink);
- mVideoSink->resize_forced_always = true;
- mVideoSink->resize_try_width = texture_width;
- mVideoSink->resize_try_height = texture_height;
- GST_OBJECT_UNLOCK(mVideoSink);
- }
-
- mTextureWidth = texture_width;
- mTextureHeight = texture_height;
- }
- }
- }
- else if(message_name == "load_uri")
- {
- std::string uri = message_in.getValue("uri");
- navigateTo( uri );
- sendStatus();
- }
- else if(message_name == "mouse_event")
- {
- std::string event = message_in.getValue("event");
- S32 x = message_in.getValueS32("x");
- S32 y = message_in.getValueS32("y");
-
- if(event == "down")
- {
- mouseDown(x, y);
- }
- else if(event == "up")
- {
- mouseUp(x, y);
- }
- else if(event == "move")
- {
- mouseMove(x, y);
- };
- };
- }
- else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME)
- {
- if(message_name == "stop")
- {
- stop();
- }
- else if(message_name == "start")
- {
- double rate = 0.0;
- if(message_in.hasValue("rate"))
- {
- rate = message_in.getValueReal("rate");
- }
- // NOTE: we don't actually support rate.
- play(rate);
- }
- else if(message_name == "pause")
- {
- pause();
- }
- else if(message_name == "seek")
- {
- double time = message_in.getValueReal("time");
- // defer the actual seek in case we haven't
- // really truly started yet in which case there
- // is nothing to seek upon
- mSeekWanted = true;
- mSeekDestination = time;
- }
- else if(message_name == "set_loop")
- {
- bool loop = message_in.getValueBoolean("loop");
- mIsLooping = loop;
- }
- else if(message_name == "set_volume")
- {
- double volume = message_in.getValueReal("volume");
- setVolume(volume);
- }
- }
- else
- {
- INFOMSG("MediaPluginGStreamer010::receiveMessage: unknown message class: %s", message_class.c_str());
- }
- }
-}
-
-int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data)
-{
- if (MediaPluginGStreamer010::startup())
- {
- MediaPluginGStreamer010 *self = new MediaPluginGStreamer010(host_send_func, host_user_data);
- *plugin_send_func = MediaPluginGStreamer010::staticReceiveMessage;
- *plugin_user_data = (void*)self;
-
- return 0; // okay
- }
- else
- {
- return -1; // failed to init
- }
-}
-
-#else // LL_GSTREAMER010_ENABLED
-
-// Stubbed-out class with constructor/destructor (necessary or windows linker
-// will just think its dead code and optimize it all out)
-class MediaPluginGStreamer010 : public MediaPluginBase
-{
-public:
- MediaPluginGStreamer010(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data);
- ~MediaPluginGStreamer010();
- /* virtual */ void receiveMessage(const char *message_string);
-};
-
-MediaPluginGStreamer010::MediaPluginGStreamer010(
- LLPluginInstance::sendMessageFunction host_send_func,
- void *host_user_data ) :
- MediaPluginBase(host_send_func, host_user_data)
-{
- // no-op
-}
-
-MediaPluginGStreamer010::~MediaPluginGStreamer010()
-{
- // no-op
-}
-
-void MediaPluginGStreamer010::receiveMessage(const char *message_string)
-{
- // no-op
-}
-
-// We're building without GStreamer enabled. Just refuse to initialize.
-int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data)
-{
- return -1;
-}
-
-#endif // LL_GSTREAMER010_ENABLED
diff --git a/indra/media_plugins/gstreamer10/CMakeLists.txt b/indra/media_plugins/gstreamer10/CMakeLists.txt
new file mode 100644
index 0000000000..14ce5bfaa1
--- /dev/null
+++ b/indra/media_plugins/gstreamer10/CMakeLists.txt
@@ -0,0 +1,41 @@
+# -*- cmake -*-
+
+project(media_plugin_gstreamer10)
+
+include(00-Common)
+include(LLCommon)
+include(LLImage)
+include(LLMath)
+include(LLWindow)
+include(Linking)
+include(PluginAPI)
+include(OpenGL)
+include(GLIB)
+
+include(GStreamer10Plugin)
+
+### media_plugin_gstreamer10
+
+set(media_plugin_gstreamer10_SOURCE_FILES
+ media_plugin_gstreamer10.cpp
+ )
+
+set(media_plugin_gstreamer10_HEADER_FILES
+ llmediaimplgstreamer_syms.h
+ llmediaimplgstreamertriviallogging.h
+ )
+
+add_library(media_plugin_gstreamer10
+ SHARED
+ ${media_plugin_gstreamer10_SOURCE_FILES}
+)
+
+target_link_libraries(media_plugin_gstreamer10 media_plugin_base ll::gstreamer10 )
+
+if (WINDOWS)
+ set_target_properties(
+ media_plugin_gstreamer10
+ PROPERTIES
+ LINK_FLAGS "/MANIFEST:NO /SAFESEH:NO /NODEFAULTLIB:LIBCMT"
+ )
+endif (WINDOWS)
diff --git a/indra/media_plugins/gstreamer010/llmediaimplgstreamer.h b/indra/media_plugins/gstreamer10/llmediaimplgstreamer.h
index cae11a5cb3..cae11a5cb3 100644
--- a/indra/media_plugins/gstreamer010/llmediaimplgstreamer.h
+++ b/indra/media_plugins/gstreamer10/llmediaimplgstreamer.h
diff --git a/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc b/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc
new file mode 100644
index 0000000000..6f5bb04bdf
--- /dev/null
+++ b/indra/media_plugins/gstreamer10/llmediaimplgstreamer_syms_raw.inc
@@ -0,0 +1,71 @@
+#define G gstSymbolGrabber
+
+LL_GRAB_SYM(G, true, gst_buffer_new, GstBuffer*, void)
+LL_GRAB_SYM(G, true, gst_structure_set_value, void, GstStructure *, const gchar *, const GValue*)
+LL_GRAB_SYM(G, true, gst_init_check, gboolean, int *argc, char **argv[], GError ** err)
+LL_GRAB_SYM(G, true, gst_message_get_type, GType, void)
+LL_GRAB_SYM(G, true, gst_message_type_get_name, const gchar*, GstMessageType type)
+LL_GRAB_SYM(G, true, gst_message_parse_error, void, GstMessage *message, GError **gerror, gchar **debug)
+LL_GRAB_SYM(G, true, gst_message_parse_warning, void, GstMessage *message, GError **gerror, gchar **debug)
+LL_GRAB_SYM(G, true, gst_message_parse_state_changed, void, GstMessage *message, GstState *oldstate, GstState *newstate, GstState *pending)
+LL_GRAB_SYM(G, true, gst_element_set_state, GstStateChangeReturn, GstElement *element, GstState state)
+LL_GRAB_SYM(G, true, gst_object_unref, void, gpointer object)
+LL_GRAB_SYM(G, true, gst_object_get_type, GType, void)
+LL_GRAB_SYM(G, true, gst_pipeline_get_type, GType, void)
+LL_GRAB_SYM(G, true, gst_pipeline_get_bus, GstBus*, GstPipeline *pipeline)
+LL_GRAB_SYM(G, true, gst_bus_add_watch, guint, GstBus * bus, GstBusFunc func, gpointer user_data)
+LL_GRAB_SYM(G, true, gst_element_factory_make, GstElement*, const gchar *factoryname, const gchar *name)
+LL_GRAB_SYM(G, true, gst_element_get_type, GType, void)
+LL_GRAB_SYM(G, true, gst_static_pad_template_get, GstPadTemplate*, GstStaticPadTemplate *pad_template)
+LL_GRAB_SYM(G, true, gst_element_class_add_pad_template, void, GstElementClass *klass, GstPadTemplate *temp)
+LL_GRAB_SYM(G, true, gst_caps_from_string, GstCaps *, const gchar *string)
+LL_GRAB_SYM(G, true, gst_caps_get_structure, GstStructure *, const GstCaps *caps, guint index)
+LL_GRAB_SYM(G, true, gst_element_register, gboolean, GstPlugin *plugin, const gchar *name, guint rank, GType type)
+LL_GRAB_SYM(G, true, gst_structure_get_int, gboolean, const GstStructure *structure, const gchar *fieldname, gint *value)
+LL_GRAB_SYM(G, true, gst_structure_get_value, const GValue *, const GstStructure *structure, const gchar *fieldname)
+LL_GRAB_SYM(G, true, gst_value_get_fraction_numerator, gint, const GValue *value)
+LL_GRAB_SYM(G, true, gst_value_get_fraction_denominator, gint, const GValue *value)
+LL_GRAB_SYM(G, true, gst_structure_get_name, const gchar *, const GstStructure *structure)
+LL_GRAB_SYM(G, true, gst_element_seek, bool, GstElement *, gdouble, GstFormat, GstSeekFlags, GstSeekType, gint64, GstSeekType, gint64)
+
+LL_GRAB_SYM(G, false, gst_registry_fork_set_enabled, void, gboolean enabled)
+LL_GRAB_SYM(G, false, gst_segtrap_set_enabled, void, gboolean enabled)
+LL_GRAB_SYM(G, false, gst_message_parse_buffering, void, GstMessage *message, gint *percent)
+LL_GRAB_SYM(G, false, gst_message_parse_info, void, GstMessage *message, GError **gerror, gchar **debug)
+LL_GRAB_SYM(G, false, gst_element_query_position, gboolean, GstElement *element, GstFormat *format, gint64 *cur)
+LL_GRAB_SYM(G, false, gst_version, void, guint *major, guint *minor, guint *micro, guint *nano)
+
+LL_GRAB_SYM(G, true, gst_message_parse_tag, void, GstMessage *, GstTagList **)
+LL_GRAB_SYM(G, true, gst_tag_list_foreach, void, const GstTagList *, GstTagForeachFunc, gpointer)
+LL_GRAB_SYM(G, true, gst_tag_list_get_tag_size, guint, const GstTagList *, const gchar *)
+LL_GRAB_SYM(G, true, gst_tag_list_get_value_index, const GValue *, const GstTagList *, const gchar *, guint)
+
+LL_GRAB_SYM(G, true, gst_caps_new_simple, GstCaps*, const char *, const char*, ... )
+
+LL_GRAB_SYM(G, true, gst_sample_get_caps, GstCaps*, GstSample* )
+LL_GRAB_SYM(G, true, gst_sample_get_buffer, GstBuffer*, GstSample* )
+LL_GRAB_SYM(G, true, gst_buffer_map, gboolean, GstBuffer*, GstMapInfo*, GstMapFlags )
+LL_GRAB_SYM(G, true, gst_buffer_unmap, void, GstBuffer*, GstMapInfo* )
+
+LL_GRAB_SYM(G, true, gst_app_sink_set_caps, void, GstAppSink*, GstCaps const* )
+LL_GRAB_SYM(G, true, gst_app_sink_pull_sample, GstSample*, GstAppSink* )
+
+LL_GRAB_SYM(G, true, g_free, void, gpointer )
+LL_GRAB_SYM(G, true, g_error_free, void, GError* )
+
+LL_GRAB_SYM(G, true, g_main_context_pending, gboolean, GMainContext* )
+LL_GRAB_SYM(G, true, g_main_loop_get_context, GMainContext*, GMainLoop* )
+LL_GRAB_SYM(G, true, g_main_context_iteration, gboolean, GMainContext*, gboolean )
+LL_GRAB_SYM(G, true, g_main_loop_new, GMainLoop*, GMainContext*, gboolean )
+LL_GRAB_SYM(G, true, g_main_loop_quit, void, GMainLoop* )
+LL_GRAB_SYM(G, true, gst_mini_object_unref, void, GstMiniObject* )
+LL_GRAB_SYM(G, true, g_object_set, void, gpointer, gchar const*, ... )
+LL_GRAB_SYM(G, true, g_source_remove, gboolean, guint )
+LL_GRAB_SYM(G, true, g_value_get_string, gchar const*, GValue const* )
+
+LL_GRAB_SYM(G, true, gst_debug_set_active, void, gboolean )
+LL_GRAB_SYM(G, true, gst_debug_add_log_function, void, GstLogFunction, gpointer, GDestroyNotify )
+LL_GRAB_SYM(G, true, gst_debug_set_default_threshold, void, GstDebugLevel )
+LL_GRAB_SYM(G, true, gst_debug_message_get , gchar const*, GstDebugMessage * )
+
+#undef G
diff --git a/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp b/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp
new file mode 100644
index 0000000000..0f45c151a2
--- /dev/null
+++ b/indra/media_plugins/gstreamer10/media_plugin_gstreamer10.cpp
@@ -0,0 +1,958 @@
+/**
+ * @file media_plugin_gstreamer10.cpp
+ * @brief GStreamer-1.0 plugin for LLMedia API plugin system
+ *
+ * @cond
+ * $LicenseInfo:firstyear=2016&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2016, Linden Research, Inc. / Nicky Dasmijn
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
+ * $/LicenseInfo$
+ * @endcond
+ */
+
+#define FLIP_Y
+
+#include "linden_common.h"
+
+#include "llgl.h"
+
+#include "llplugininstance.h"
+#include "llpluginmessage.h"
+#include "llpluginmessageclasses.h"
+#include "media_plugin_base.h"
+
+#define G_DISABLE_CAST_CHECKS
+extern "C" {
+#include <gst/gst.h>
+#include <gst/app/gstappsink.h>
+}
+
+SymbolGrabber gstSymbolGrabber;
+
+#include "llmediaimplgstreamer_syms_raw.inc"
+
+static inline void llgst_caps_unref( GstCaps * caps )
+{
+ llgst_mini_object_unref( GST_MINI_OBJECT_CAST( caps ) );
+}
+
+static inline void llgst_sample_unref( GstSample *aSample )
+{
+ llgst_mini_object_unref( GST_MINI_OBJECT_CAST( aSample ) );
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+class MediaPluginGStreamer10 : public MediaPluginBase
+{
+public:
+ MediaPluginGStreamer10(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data);
+ ~MediaPluginGStreamer10();
+
+ /* virtual */ void receiveMessage(const char *message_string);
+
+ static bool startup();
+ static bool closedown();
+
+ gboolean processGSTEvents(GstBus *bus, GstMessage *message);
+
+private:
+ std::string getVersion();
+ bool navigateTo( const std::string urlIn );
+ bool seek( double time_sec );
+ bool setVolume( float volume );
+
+ // misc
+ bool pause();
+ bool stop();
+ bool play(double rate);
+ bool getTimePos(double &sec_out);
+
+ double MIN_LOOP_SEC = 1.0F;
+ U32 INTERNAL_TEXTURE_SIZE = 1024;
+
+ bool mIsLooping;
+
+ enum ECommand {
+ COMMAND_NONE,
+ COMMAND_STOP,
+ COMMAND_PLAY,
+ COMMAND_FAST_FORWARD,
+ COMMAND_FAST_REWIND,
+ COMMAND_PAUSE,
+ COMMAND_SEEK,
+ };
+ ECommand mCommand;
+
+private:
+ bool unload();
+ bool load();
+
+ bool update(int milliseconds);
+ void mouseDown( int x, int y );
+ void mouseUp( int x, int y );
+ void mouseMove( int x, int y );
+
+ static bool mDoneInit;
+
+ guint mBusWatchID;
+
+ float mVolume;
+
+ int mDepth;
+
+ // padded texture size we need to write into
+ int mTextureWidth;
+ int mTextureHeight;
+
+ bool mSeekWanted;
+ double mSeekDestination;
+
+ // Very GStreamer-specific
+ GMainLoop *mPump; // event pump for this media
+ GstElement *mPlaybin;
+ GstAppSink *mAppSink;
+};
+
+//static
+bool MediaPluginGStreamer10::mDoneInit = false;
+
+MediaPluginGStreamer10::MediaPluginGStreamer10( LLPluginInstance::sendMessageFunction host_send_func,
+ void *host_user_data )
+ : MediaPluginBase(host_send_func, host_user_data)
+ , mBusWatchID ( 0 )
+ , mSeekWanted(false)
+ , mSeekDestination(0.0)
+ , mPump ( nullptr )
+ , mPlaybin ( nullptr )
+ , mAppSink ( nullptr )
+ , mCommand ( COMMAND_NONE )
+{
+}
+
+gboolean MediaPluginGStreamer10::processGSTEvents(GstBus *bus, GstMessage *message)
+{
+ if (!message)
+ return TRUE; // shield against GStreamer bug
+
+ switch (GST_MESSAGE_TYPE (message))
+ {
+ case GST_MESSAGE_BUFFERING:
+ {
+ // NEEDS GST 0.10.11+
+ if (llgst_message_parse_buffering)
+ {
+ gint percent = 0;
+ llgst_message_parse_buffering(message, &percent);
+ }
+ break;
+ }
+ case GST_MESSAGE_STATE_CHANGED:
+ {
+ GstState old_state;
+ GstState new_state;
+ GstState pending_state;
+ llgst_message_parse_state_changed(message,
+ &old_state,
+ &new_state,
+ &pending_state);
+
+ switch (new_state)
+ {
+ case GST_STATE_VOID_PENDING:
+ break;
+ case GST_STATE_NULL:
+ break;
+ case GST_STATE_READY:
+ setStatus(STATUS_LOADED);
+ break;
+ case GST_STATE_PAUSED:
+ setStatus(STATUS_PAUSED);
+ break;
+ case GST_STATE_PLAYING:
+ setStatus(STATUS_PLAYING);
+ break;
+ }
+ break;
+ }
+ case GST_MESSAGE_ERROR:
+ {
+ GError *err = nullptr;
+ gchar *debug = nullptr;
+
+ llgst_message_parse_error (message, &err, &debug);
+ if (err)
+ llg_error_free (err);
+ llg_free (debug);
+
+ mCommand = COMMAND_STOP;
+
+ setStatus(STATUS_ERROR);
+
+ break;
+ }
+ case GST_MESSAGE_INFO:
+ {
+ if (llgst_message_parse_info)
+ {
+ GError *err = nullptr;
+ gchar *debug = nullptr;
+
+ llgst_message_parse_info (message, &err, &debug);
+ if (err)
+ llg_error_free (err);
+ llg_free (debug);
+ }
+ break;
+ }
+ case GST_MESSAGE_WARNING:
+ {
+ GError *err = nullptr;
+ gchar *debug = nullptr;
+
+ llgst_message_parse_warning (message, &err, &debug);
+ if (err)
+ llg_error_free (err);
+ llg_free (debug);
+
+ break;
+ }
+ case GST_MESSAGE_EOS:
+ /* end-of-stream */
+ if (mIsLooping)
+ {
+ double eos_pos_sec = 0.0F;
+ bool got_eos_position = getTimePos(eos_pos_sec);
+
+ if (got_eos_position && eos_pos_sec < MIN_LOOP_SEC)
+ {
+ // if we know that the movie is really short, don't
+ // loop it else it can easily become a time-hog
+ // because of GStreamer spin-up overhead
+ // inject a COMMAND_PAUSE
+ mCommand = COMMAND_PAUSE;
+ }
+ else
+ {
+ stop();
+ play(1.0);
+ }
+ }
+ else // not a looping media
+ {
+ // inject a COMMAND_STOP
+ mCommand = COMMAND_STOP;
+ }
+ break;
+ default:
+ /* unhandled message */
+ break;
+ }
+
+ /* we want to be notified again the next time there is a message
+ * on the bus, so return true (false means we want to stop watching
+ * for messages on the bus and our callback should not be called again)
+ */
+ return TRUE;
+}
+
+extern "C" {
+ gboolean llmediaimplgstreamer_bus_callback (GstBus *bus,
+ GstMessage *message,
+ gpointer data)
+ {
+ MediaPluginGStreamer10 *impl = (MediaPluginGStreamer10*)data;
+ return impl->processGSTEvents(bus, message);
+ }
+} // extern "C"
+
+
+
+bool MediaPluginGStreamer10::navigateTo ( const std::string urlIn )
+{
+ if (!mDoneInit)
+ return false; // error
+
+ setStatus(STATUS_LOADING);
+
+ mSeekWanted = false;
+
+ if (nullptr == mPump || nullptr == mPlaybin)
+ {
+ setStatus(STATUS_ERROR);
+ return false; // error
+ }
+
+ llg_object_set (G_OBJECT (mPlaybin), "uri", urlIn.c_str(), nullptr);
+
+ // navigateTo implicitly plays, too.
+ play(1.0);
+
+ return true;
+}
+
+
+class GstSampleUnref
+{
+ GstSample *mT;
+public:
+ GstSampleUnref( GstSample *aT )
+ : mT( aT )
+ { llassert_always( mT ); }
+
+ ~GstSampleUnref( )
+ { llgst_sample_unref( mT ); }
+};
+
+bool MediaPluginGStreamer10::update(int milliseconds)
+{
+ if (!mDoneInit)
+ return false; // error
+
+ // DEBUGMSG("updating media...");
+
+ // sanity check
+ if (nullptr == mPump || nullptr == mPlaybin)
+ {
+ return false;
+ }
+
+ // see if there's an outstanding seek wanted
+ if (mSeekWanted &&
+ // bleh, GST has to be happy that the movie is really truly playing
+ // or it may quietly ignore the seek (with rtsp:// at least).
+ (GST_STATE(mPlaybin) == GST_STATE_PLAYING))
+ {
+ seek(mSeekDestination);
+ mSeekWanted = false;
+ }
+
+ // *TODO: time-limit - but there isn't a lot we can do here, most
+ // time is spent in gstreamer's own opaque worker-threads. maybe
+ // we can do something sneaky like only unlock the video object
+ // for 'milliseconds' and otherwise hold the lock.
+ while (llg_main_context_pending(llg_main_loop_get_context(mPump)))
+ {
+ llg_main_context_iteration(llg_main_loop_get_context(mPump), FALSE);
+ }
+
+ // check for availability of a new frame
+
+ if( !mAppSink )
+ return true;
+
+ if( GST_STATE(mPlaybin) != GST_STATE_PLAYING) // Do not try to pull a sample if not in playing state
+ return true;
+
+ GstSample *pSample = llgst_app_sink_pull_sample( mAppSink );
+ if(!pSample)
+ return false; // Done playing
+
+ GstSampleUnref oSampleUnref( pSample );
+ GstCaps *pCaps = llgst_sample_get_caps ( pSample );
+ if (!pCaps)
+ return false;
+
+ gint width = 0, height = 0;
+ GstStructure *pStruct = llgst_caps_get_structure ( pCaps, 0);
+
+ if(!llgst_structure_get_int ( pStruct, "width", &width) )
+ width = 0;
+ if(!llgst_structure_get_int ( pStruct, "height", &height) )
+ height = 0;
+
+ if( !mPixels || width == 0 || height == 0)
+ return true;
+
+ GstBuffer *pBuffer = llgst_sample_get_buffer ( pSample );
+ GstMapInfo map;
+ llgst_buffer_map ( pBuffer, &map, GST_MAP_READ);
+
+ // Our render buffer is always 1kx1k
+
+ U32 rowSkip = INTERNAL_TEXTURE_SIZE / mTextureHeight;
+ U32 colSkip = INTERNAL_TEXTURE_SIZE / mTextureWidth;
+
+ for (int row = 0; row < mTextureHeight; ++row)
+ {
+ U8 const *pTexelIn = map.data + (row*rowSkip * width *3);
+#ifndef FLIP_Y
+ U8 *pTexelOut = mPixels + (row * mTextureWidth * mDepth );
+#else
+ U8 *pTexelOut = mPixels + ((mTextureHeight-row-1) * mTextureWidth * mDepth );
+#endif
+ for( int col = 0; col < mTextureWidth; ++col )
+ {
+ pTexelOut[ 0 ] = pTexelIn[0];
+ pTexelOut[ 1 ] = pTexelIn[1];
+ pTexelOut[ 2 ] = pTexelIn[2];
+ pTexelOut += mDepth;
+ pTexelIn += colSkip*3;
+ }
+ }
+
+ llgst_buffer_unmap( pBuffer, &map );
+ setDirty(0,0,mTextureWidth,mTextureHeight);
+
+ return true;
+}
+
+void MediaPluginGStreamer10::mouseDown( int x, int y )
+{
+ // do nothing
+}
+
+void MediaPluginGStreamer10::mouseUp( int x, int y )
+{
+ // do nothing
+}
+
+void MediaPluginGStreamer10::mouseMove( int x, int y )
+{
+ // do nothing
+}
+
+
+bool MediaPluginGStreamer10::pause()
+{
+ // todo: error-check this?
+ if (mDoneInit && mPlaybin)
+ {
+ llgst_element_set_state(mPlaybin, GST_STATE_PAUSED);
+ return true;
+ }
+ return false;
+}
+
+bool MediaPluginGStreamer10::stop()
+{
+ // todo: error-check this?
+ if (mDoneInit && mPlaybin)
+ {
+ llgst_element_set_state(mPlaybin, GST_STATE_READY);
+ return true;
+ }
+ return false;
+}
+
+bool MediaPluginGStreamer10::play(double rate)
+{
+ // NOTE: we don't actually support non-natural rate.
+
+ // todo: error-check this?
+ if (mDoneInit && mPlaybin)
+ {
+ llgst_element_set_state(mPlaybin, GST_STATE_PLAYING);
+ return true;
+ }
+ return false;
+}
+
+bool MediaPluginGStreamer10::setVolume( float volume )
+{
+ // we try to only update volume as conservatively as
+ // possible, as many gst-plugins-base versions up to at least
+ // November 2008 have critical race-conditions in setting volume - sigh
+ if (mVolume == volume)
+ return true; // nothing to do, everything's fine
+
+ mVolume = volume;
+ if (mDoneInit && mPlaybin)
+ {
+ llg_object_set(mPlaybin, "volume", mVolume, nullptr);
+ return true;
+ }
+
+ return false;
+}
+
+bool MediaPluginGStreamer10::seek(double time_sec)
+{
+ bool success = false;
+ if (mDoneInit && mPlaybin)
+ {
+ success = llgst_element_seek(mPlaybin, 1.0F, GST_FORMAT_TIME,
+ GstSeekFlags(GST_SEEK_FLAG_FLUSH |
+ GST_SEEK_FLAG_KEY_UNIT),
+ GST_SEEK_TYPE_SET, gint64(time_sec*GST_SECOND),
+ GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
+ }
+ return success;
+}
+
+bool MediaPluginGStreamer10::getTimePos(double &sec_out)
+{
+ bool got_position = false;
+ if (mDoneInit && mPlaybin)
+ {
+ gint64 pos(0);
+ GstFormat timefmt = GST_FORMAT_TIME;
+ got_position =
+ llgst_element_query_position &&
+ llgst_element_query_position(mPlaybin,
+ &timefmt,
+ &pos);
+ got_position = got_position
+ && (timefmt == GST_FORMAT_TIME);
+ // GStreamer may have other ideas, but we consider the current position
+ // undefined if not PLAYING or PAUSED
+ got_position = got_position &&
+ (GST_STATE(mPlaybin) == GST_STATE_PLAYING ||
+ GST_STATE(mPlaybin) == GST_STATE_PAUSED);
+ if (got_position && !GST_CLOCK_TIME_IS_VALID(pos))
+ {
+ if (GST_STATE(mPlaybin) == GST_STATE_PLAYING)
+ {
+ // if we're playing then we treat an invalid clock time
+ // as 0, for complicated reasons (insert reason here)
+ pos = 0;
+ }
+ else
+ {
+ got_position = false;
+ }
+
+ }
+ // If all the preconditions succeeded... we can trust the result.
+ if (got_position)
+ {
+ sec_out = double(pos) / double(GST_SECOND); // gst to sec
+ }
+ }
+ return got_position;
+}
+
+bool MediaPluginGStreamer10::load()
+{
+ if (!mDoneInit)
+ return false; // error
+
+ setStatus(STATUS_LOADING);
+
+ mIsLooping = false;
+ mVolume = 0.1234567f; // minor hack to force an initial volume update
+
+ // Create a pumpable main-loop for this media
+ mPump = llg_main_loop_new (nullptr, FALSE);
+ if (!mPump)
+ {
+ setStatus(STATUS_ERROR);
+ return false; // error
+ }
+
+ // instantiate a playbin element to do the hard work
+ mPlaybin = llgst_element_factory_make ("playbin", "");
+ if (!mPlaybin)
+ {
+ setStatus(STATUS_ERROR);
+ return false; // error
+ }
+
+ // get playbin's bus
+ GstBus *bus = llgst_pipeline_get_bus (GST_PIPELINE (mPlaybin));
+ if (!bus)
+ {
+ setStatus(STATUS_ERROR);
+ return false; // error
+ }
+ mBusWatchID = llgst_bus_add_watch (bus,
+ llmediaimplgstreamer_bus_callback,
+ this);
+ llgst_object_unref (bus);
+
+ mAppSink = (GstAppSink*)(llgst_element_factory_make ("appsink", ""));
+
+ GstCaps* pCaps = llgst_caps_new_simple( "video/x-raw",
+ "format", G_TYPE_STRING, "RGB",
+ "width", G_TYPE_INT, INTERNAL_TEXTURE_SIZE,
+ "height", G_TYPE_INT, INTERNAL_TEXTURE_SIZE,
+ nullptr );
+
+ llgst_app_sink_set_caps( mAppSink, pCaps );
+ llgst_caps_unref( pCaps );
+
+ if (!mAppSink)
+ {
+ setStatus(STATUS_ERROR);
+ return false;
+ }
+
+ llg_object_set(mPlaybin, "video-sink", mAppSink, nullptr);
+
+ return true;
+}
+
+bool MediaPluginGStreamer10::unload ()
+{
+ if (!mDoneInit)
+ return false; // error
+
+ // stop getting callbacks for this bus
+ llg_source_remove(mBusWatchID);
+ mBusWatchID = 0;
+
+ if (mPlaybin)
+ {
+ llgst_element_set_state (mPlaybin, GST_STATE_NULL);
+ llgst_object_unref (GST_OBJECT (mPlaybin));
+ mPlaybin = nullptr;
+ }
+
+ if (mPump)
+ {
+ llg_main_loop_quit(mPump);
+ mPump = nullptr;
+ }
+
+ mAppSink = nullptr;
+
+ setStatus(STATUS_NONE);
+
+ return true;
+}
+
+void LogFunction(GstDebugCategory *category, GstDebugLevel level, const gchar *file, const gchar *function, gint line, GObject *object, GstDebugMessage *message, gpointer user_data )
+{
+ std::cerr << file << ":" << line << "(" << function << "): " << llgst_debug_message_get( message ) << std::endl;
+}
+
+//static
+bool MediaPluginGStreamer10::startup()
+{
+ // first - check if GStreamer is explicitly disabled
+ if (nullptr != getenv("LL_DISABLE_GSTREAMER"))
+ return false;
+
+ // only do global GStreamer initialization once.
+ if (!mDoneInit)
+ {
+ ll_init_apr();
+
+ // Get symbols!
+ std::vector< std::string > vctDSONames;
+ vctDSONames.push_back( "libgstreamer-1.0.so.0" );
+ vctDSONames.push_back( "libgstapp-1.0.so.0" );
+ vctDSONames.push_back( "libglib-2.0.so.0" );
+ vctDSONames.push_back( "libgobject-2.0.so" );
+ if( !gstSymbolGrabber.grabSymbols( vctDSONames ) )
+ return false;
+
+ if (llgst_segtrap_set_enabled)
+ {
+ llgst_segtrap_set_enabled(FALSE);
+ }
+
+ // Gstreamer tries a fork during init, waitpid-ing on it,
+ // which conflicts with any installed SIGCHLD handler...
+ struct sigaction tmpact, oldact;
+ if (llgst_registry_fork_set_enabled ) {
+ // if we can disable SIGCHLD-using forking behaviour,
+ // do it.
+ llgst_registry_fork_set_enabled(false);
+ }
+ else {
+ // else temporarily install default SIGCHLD handler
+ // while GStreamer initialises
+ tmpact.sa_handler = SIG_DFL;
+ sigemptyset( &tmpact.sa_mask );
+ tmpact.sa_flags = SA_SIGINFO;
+ sigaction(SIGCHLD, &tmpact, &oldact);
+ }
+ // Protect against GStreamer resetting the locale, yuck.
+ static std::string saved_locale;
+ saved_locale = setlocale(LC_ALL, nullptr);
+
+ llgst_debug_set_default_threshold( GST_LEVEL_WARNING );
+ llgst_debug_add_log_function( LogFunction, nullptr, nullptr );
+ llgst_debug_set_active( false );
+
+ // finally, try to initialize GStreamer!
+ GError *err = nullptr;
+ gboolean init_gst_success = llgst_init_check(nullptr, nullptr, &err);
+
+ // restore old locale
+ setlocale(LC_ALL, saved_locale.c_str() );
+
+ // restore old SIGCHLD handler
+ if (!llgst_registry_fork_set_enabled)
+ sigaction(SIGCHLD, &oldact, nullptr);
+
+ if (!init_gst_success) // fail
+ {
+ if (err)
+ llg_error_free(err);
+ return false;
+ }
+
+ mDoneInit = true;
+ }
+
+ return true;
+}
+
+//static
+bool MediaPluginGStreamer10::closedown()
+{
+ if (!mDoneInit)
+ return false; // error
+
+ gstSymbolGrabber.ungrabSymbols();
+ mDoneInit = false;
+
+ return true;
+}
+
+MediaPluginGStreamer10::~MediaPluginGStreamer10()
+{
+ closedown();
+}
+
+std::string MediaPluginGStreamer10::getVersion()
+{
+ std::string plugin_version = "GStreamer10 media plugin, GStreamer version ";
+ if (mDoneInit &&
+ llgst_version)
+ {
+ guint major, minor, micro, nano;
+ llgst_version(&major, &minor, &micro, &nano);
+ plugin_version += llformat("%u.%u.%u.%u (runtime), %u.%u.%u.%u (headers)", (unsigned int)major, (unsigned int)minor,
+ (unsigned int)micro, (unsigned int)nano, (unsigned int)GST_VERSION_MAJOR, (unsigned int)GST_VERSION_MINOR,
+ (unsigned int)GST_VERSION_MICRO, (unsigned int)GST_VERSION_NANO);
+ }
+ else
+ {
+ plugin_version += "(unknown)";
+ }
+ return plugin_version;
+}
+
+void MediaPluginGStreamer10::receiveMessage(const char *message_string)
+{
+ LLPluginMessage message_in;
+
+ if(message_in.parse(message_string) >= 0)
+ {
+ std::string message_class = message_in.getClass();
+ std::string message_name = message_in.getName();
+
+ if(message_class == LLPLUGIN_MESSAGE_CLASS_BASE)
+ {
+ if(message_name == "init")
+ {
+ LLPluginMessage message("base", "init_response");
+ LLSD versions = LLSD::emptyMap();
+ versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION;
+ versions[LLPLUGIN_MESSAGE_CLASS_MEDIA] = LLPLUGIN_MESSAGE_CLASS_MEDIA_VERSION;
+ versions[LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME] = LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME_VERSION;
+ message.setValueLLSD("versions", versions);
+
+ load();
+
+ message.setValue("plugin_version", getVersion());
+ sendMessage(message);
+ }
+ else if(message_name == "idle")
+ {
+ // no response is necessary here.
+ double time = message_in.getValueReal("time");
+
+ // Convert time to milliseconds for update()
+ update((int)(time * 1000.0f));
+ }
+ else if(message_name == "cleanup")
+ {
+ unload();
+ closedown();
+ }
+ else if(message_name == "shm_added")
+ {
+ SharedSegmentInfo info;
+ info.mAddress = message_in.getValuePointer("address");
+ info.mSize = (size_t)message_in.getValueS32("size");
+ std::string name = message_in.getValue("name");
+
+ mSharedSegments.insert(SharedSegmentMap::value_type(name, info));
+ }
+ else if(message_name == "shm_remove")
+ {
+ std::string name = message_in.getValue("name");
+
+ SharedSegmentMap::iterator iter = mSharedSegments.find(name);
+ if(iter != mSharedSegments.end())
+ {
+ if(mPixels == iter->second.mAddress)
+ {
+ // This is the currently active pixel buffer. Make sure we stop drawing to it.
+ mPixels = nullptr;
+ mTextureSegmentName.clear();
+ }
+ mSharedSegments.erase(iter);
+ }
+
+ // Send the response so it can be cleaned up.
+ LLPluginMessage message("base", "shm_remove_response");
+ message.setValue("name", name);
+ sendMessage(message);
+ }
+ }
+ else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA)
+ {
+ if(message_name == "init")
+ {
+ // Plugin gets to decide the texture parameters to use.
+ LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "texture_params");
+ // lame to have to decide this now, it depends on the movie. Oh well.
+ mDepth = 4;
+
+ mTextureWidth = 1;
+ mTextureHeight = 1;
+
+ message.setValueU32("format", GL_RGBA);
+ message.setValueU32("type", GL_UNSIGNED_INT_8_8_8_8_REV);
+
+ message.setValueS32("depth", mDepth);
+ message.setValueS32("default_width", INTERNAL_TEXTURE_SIZE );
+ message.setValueS32("default_height", INTERNAL_TEXTURE_SIZE );
+ message.setValueU32("internalformat", GL_RGBA8);
+ message.setValueBoolean("coords_opengl", true); // true == use OpenGL-style coordinates, false == (0,0) is upper left.
+ message.setValueBoolean("allow_downsample", true); // we respond with grace and performance if asked to downscale
+ sendMessage(message);
+ }
+ else if(message_name == "size_change")
+ {
+ std::string name = message_in.getValue("name");
+ S32 width = message_in.getValueS32("width");
+ S32 height = message_in.getValueS32("height");
+ S32 texture_width = message_in.getValueS32("texture_width");
+ S32 texture_height = message_in.getValueS32("texture_height");
+
+ LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response");
+ message.setValue("name", name);
+ message.setValueS32("width", width);
+ message.setValueS32("height", height);
+ message.setValueS32("texture_width", texture_width);
+ message.setValueS32("texture_height", texture_height);
+ sendMessage(message);
+
+ if(!name.empty())
+ {
+ // Find the shared memory region with this name
+ SharedSegmentMap::iterator iter = mSharedSegments.find(name);
+ if(iter != mSharedSegments.end())
+ {
+ mPixels = (unsigned char*)iter->second.mAddress;
+ mTextureSegmentName = name;
+
+ mTextureWidth = texture_width;
+ mTextureHeight = texture_height;
+ memset( mPixels, 0, mTextureWidth*mTextureHeight*mDepth );
+ }
+
+ LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_request");
+ message.setValue("name", mTextureSegmentName);
+ message.setValueS32("width", INTERNAL_TEXTURE_SIZE );
+ message.setValueS32("height", INTERNAL_TEXTURE_SIZE );
+ sendMessage(message);
+
+ }
+ }
+ else if(message_name == "load_uri")
+ {
+ std::string uri = message_in.getValue("uri");
+ navigateTo( uri );
+ sendStatus();
+ }
+ else if(message_name == "mouse_event")
+ {
+ std::string event = message_in.getValue("event");
+ S32 x = message_in.getValueS32("x");
+ S32 y = message_in.getValueS32("y");
+
+ if(event == "down")
+ {
+ mouseDown(x, y);
+ }
+ else if(event == "up")
+ {
+ mouseUp(x, y);
+ }
+ else if(event == "move")
+ {
+ mouseMove(x, y);
+ };
+ };
+ }
+ else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME)
+ {
+ if(message_name == "stop")
+ {
+ stop();
+ }
+ else if(message_name == "start")
+ {
+ double rate = 0.0;
+ if(message_in.hasValue("rate"))
+ {
+ rate = message_in.getValueReal("rate");
+ }
+ // NOTE: we don't actually support rate.
+ play(rate);
+ }
+ else if(message_name == "pause")
+ {
+ pause();
+ }
+ else if(message_name == "seek")
+ {
+ double time = message_in.getValueReal("time");
+ // defer the actual seek in case we haven't
+ // really truly started yet in which case there
+ // is nothing to seek upon
+ mSeekWanted = true;
+ mSeekDestination = time;
+ }
+ else if(message_name == "set_loop")
+ {
+ bool loop = message_in.getValueBoolean("loop");
+ mIsLooping = loop;
+ }
+ else if(message_name == "set_volume")
+ {
+ double volume = message_in.getValueReal("volume");
+ setVolume(volume);
+ }
+ }
+ }
+}
+
+int init_media_plugin(LLPluginInstance::sendMessageFunction host_send_func, void *host_user_data, LLPluginInstance::sendMessageFunction *plugin_send_func, void **plugin_user_data)
+{
+ if( MediaPluginGStreamer10::startup() )
+ {
+ MediaPluginGStreamer10 *self = new MediaPluginGStreamer10(host_send_func, host_user_data);
+ *plugin_send_func = MediaPluginGStreamer10::staticReceiveMessage;
+ *plugin_user_data = (void*)self;
+
+ return 0; // okay
+ }
+ else
+ {
+ return -1; // failed to init
+ }
+}
diff --git a/indra/media_plugins/libvlc/CMakeLists.txt b/indra/media_plugins/libvlc/CMakeLists.txt
index 202cbed96e..863b4617e9 100644
--- a/indra/media_plugins/libvlc/CMakeLists.txt
+++ b/indra/media_plugins/libvlc/CMakeLists.txt
@@ -13,13 +13,6 @@ include(LibVLCPlugin)
### media_plugin_libvlc
-if(NOT ADDRESS_SIZE EQUAL 32)
- if(WINDOWS)
- ##add_definitions(/FIXED:NO)
- else(WINDOWS) # not windows therefore gcc LINUX and DARWIN
- add_definitions(-fPIC)
- endif(WINDOWS)
-endif(NOT ADDRESS_SIZE EQUAL 32)
set(media_plugin_libvlc_SOURCE_FILES
media_plugin_libvlc.cpp
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 106fe81682..03c80a596c 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1465,7 +1465,6 @@ if (LINUX)
PROPERTIES
COMPILE_DEFINITIONS "${VIEWER_CHANNEL_VERSION_DEFINES}"
)
- LIST(APPEND viewer_SOURCE_FILES llappviewerlinux_api_dbus.cpp)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed")
endif (LINUX)
diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt
index e0eaaa0bbc..0f9f025fe4 100644
--- a/indra/newview/VIEWER_VERSION.txt
+++ b/indra/newview/VIEWER_VERSION.txt
@@ -1 +1 @@
-7.1.11
+7.1.12
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index c717e62a95..6fe13d4665 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -5037,6 +5037,17 @@
<key>Value</key>
<integer>0</integer>
</map>
+ <key>MediaPluginPipeWireVolumeCatcher</key>
+ <map>
+ <key>Comment</key>
+ <string>Use PipeWire instead of PulseAudio for controlling web media volume.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>Boolean</string>
+ <key>Value</key>
+ <integer>0</integer>
+ </map>
<key>MediaControlFadeTime</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index 210ecce8db..e9f849a8c0 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -79,7 +79,7 @@ float getAmbientClamp();
void mirrorClip(vec3 pos);
-void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
+void sampleReflectionProbesLegacy(out vec3 ambenv, out vec3 glossenv, out vec3 legacyenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear);
vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, float ambiance)
diff --git a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl
index d178bf22b6..4fb24ca0b1 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl
@@ -55,7 +55,7 @@ vec4 sampleReflectionProbesDebug(vec3 pos)
return vec4(0, 0, 0, 0);
}
-void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
+void sampleReflectionProbesLegacy(out vec3 ambenv, out vec3 glossenv, out vec3 legacyenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear)
{
ambenv = vec3(reflection_probe_ambiance * 0.25);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
index 03dc3d7113..5e38864d38 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
@@ -48,7 +48,7 @@ vec3 linear_to_srgb(vec3 c);
vec3 srgb_to_linear(vec3 c);
// reflection probe interface
-void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
+void sampleReflectionProbesLegacy(out vec3 ambenv, out vec3 glossenv, out vec3 legacyenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear);
void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
index 26ab0406f6..5ee9aea09d 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl
@@ -60,7 +60,7 @@ out vec4 frag_color;
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
#endif
-void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
+void sampleReflectionProbesLegacy(out vec3 ambenv, out vec3 glossenv, out vec3 legacyenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear);
void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm);
void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity);
@@ -280,10 +280,10 @@ float getShadow(vec3 pos, vec3 norm)
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
return sampleDirectionalShadow(pos, norm, vary_texcoord0.xy);
#else
- return 1;
+ return 1.;
#endif
#else
- return 1;
+ return 1.;
#endif
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
index 5dfa196cf6..4bae7b6deb 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl
@@ -837,7 +837,7 @@ vec4 sampleReflectionProbesDebug(vec3 pos)
return col;
}
-void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
+void sampleReflectionProbesLegacy(out vec3 ambenv, out vec3 glossenv, out vec3 legacyenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit)
{
float reflection_lods = max_probe_lod;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index ca88fe7482..4231d8580e 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -69,7 +69,7 @@ vec3 scaleSoftClipFragLinear(vec3 l);
// reflection probe interface
void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent, vec3 amblit_linear);
-void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv,
+void sampleReflectionProbesLegacy(out vec3 ambenv, out vec3 glossenv, out vec3 legacyenv,
vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent, vec3 amblit_linear);
void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm);
void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity);
diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml
index 2cdd86267e..90dc361a5c 100644
--- a/indra/newview/character/avatar_lad.xml
+++ b/indra/newview/character/avatar_lad.xml
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
+<?xml version="1.0" encoding="us-ascii" standalone="yes"?>
<linden_avatar
version="2.0" wearable_definition_version="22">
<!-- The wearable_definition_version is checked during asset upload. -->
@@ -8923,8 +8923,8 @@
<!-- =========================================================== -->
<layer_set
body_region="hair"
- width="512"
- height="512"
+ width="2048"
+ height="2048"
clear_alpha="false">
<layer
name="base"
@@ -9013,8 +9013,8 @@
<layer_set
body_region="head"
- width="512"
- height="512">
+ width="2048"
+ height="2048">
<layer
name="head bump base"
fixed_color = "128,128,128,255"
@@ -10149,8 +10149,8 @@ render_pass="bump">
<!-- =========================================================== -->
<layer_set
body_region="upper_body"
- width="512"
- height="512">
+ width="2048"
+ height="2048">
<layer
name="base_upperbody bump"
render_pass="bump"
@@ -11458,8 +11458,8 @@ render_pass="bump">
<!-- =========================================================== -->
<layer_set
body_region="lower_body"
- width="512"
- height="512">
+ width="2048"
+ height="2048">
<layer
name="lower body bump base"
fixed_color = "128,128,128,255"
@@ -12448,8 +12448,8 @@ render_pass="bump">
<!-- =========================================================== -->
<layer_set
body_region="eyes"
- width="128"
- height="128">
+ width="512"
+ height="512">
<layer
name="whites">
<texture
@@ -12535,8 +12535,8 @@ render_pass="bump">
<!-- =========================================================== -->
<layer_set
body_region="skirt"
- width="512"
- height="512"
+ width="2048"
+ height="2048"
clear_alpha="false">
<layer
name="skirt_fabric"
@@ -12774,8 +12774,8 @@ render_pass="bump">
<!-- =========================================================== -->
<layer_set
body_region="leftarm"
- width="512"
- height="512"
+ width="2048"
+ height="2048"
clear_alpha="false">
<layer
name="base"
@@ -12850,8 +12850,8 @@ render_pass="bump">
<!-- =========================================================== -->
<layer_set
body_region="leftleg"
- width="512"
- height="512"
+ width="2048"
+ height="2048"
clear_alpha="false">
<layer
name="base"
@@ -12925,8 +12925,8 @@ render_pass="bump">
<!-- =========================================================== -->
<layer_set
body_region="aux1"
- width="512"
- height="512"
+ width="2048"
+ height="2048"
clear_alpha="false">
<layer
@@ -13002,8 +13002,8 @@ render_pass="bump">
<!-- =========================================================== -->
<layer_set
body_region="aux2"
- width="512"
- height="512"
+ width="2048"
+ height="2048"
clear_alpha="false">
<layer
@@ -13079,8 +13079,8 @@ render_pass="bump">
<!-- =========================================================== -->
<layer_set
body_region="aux3"
- width="512"
- height="512"
+ width="2048"
+ height="2048"
clear_alpha="false">
<layer
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index 2e220d2b1c..06ad730a40 100644
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -1,4 +1,4 @@
-version 60
+version 61
// The version number above should be incremented IF AND ONLY IF some
// change has been made that is sufficiently important to justify
// resetting the graphics preferences of all users to the recommended
@@ -68,7 +68,8 @@ RenderFSAASamples 1 3
RenderMaxTextureIndex 1 16
RenderGLContextCoreProfile 1 1
RenderGLMultiThreadedTextures 1 0
-RenderGLMultiThreadedMedia 1 0
+RenderGLMultiThreadedMedia 1 1
+RenderAppleUseMultGL 1 1
RenderReflectionsEnabled 1 1
RenderReflectionProbeDetail 1 2
RenderScreenSpaceReflections 1 1
@@ -381,6 +382,15 @@ list Intel
RenderAnisotropic 1 0
RenderFSAASamples 1 0
+// AppleGPU and NonAppleGPU can be thought of as Apple silicon vs Intel Mac
+list AppleGPU
+RenderGLMultiThreadedMedia 1 1
+RenderAppleUseMultGL 1 1
+
+list NonAppleGPU
+RenderGLMultiThreadedMedia 1 0
+RenderAppleUseMultGL 1 0
+
list GL3
RenderFSAASamples 0 0
RenderReflectionProbeDetail 0 0
diff --git a/indra/newview/gltfscenemanager.cpp b/indra/newview/gltfscenemanager.cpp
index ce54fa4c12..ed66753267 100644
--- a/indra/newview/gltfscenemanager.cpp
+++ b/indra/newview/gltfscenemanager.cpp
@@ -371,43 +371,46 @@ void GLTFSceneManager::addGLTFObject(LLViewerObject* obj, LLUUID gltf_id)
//static
void GLTFSceneManager::onGLTFBinLoadComplete(const LLUUID& id, LLAssetType::EType asset_type, void* user_data, S32 status, LLExtStat ext_status)
{
- LLViewerObject* obj = (LLViewerObject*)user_data;
- llassert(asset_type == LLAssetType::AT_GLTF_BIN);
-
- if (status == LL_ERR_NOERR)
- {
- if (obj)
+ LLAppViewer::instance()->postToMainCoro([=]()
{
- // find the Buffer with the given id in the asset
- if (obj->mGLTFAsset)
- {
- obj->mGLTFAsset->mPendingBuffers--;
-
+ LLViewerObject* obj = (LLViewerObject*)user_data;
+ llassert(asset_type == LLAssetType::AT_GLTF_BIN);
- if (obj->mGLTFAsset->mPendingBuffers == 0)
+ if (status == LL_ERR_NOERR)
+ {
+ if (obj)
{
- if (obj->mGLTFAsset->prep())
+ // find the Buffer with the given id in the asset
+ if (obj->mGLTFAsset)
{
- GLTFSceneManager& mgr = GLTFSceneManager::instance();
- if (std::find(mgr.mObjects.begin(), mgr.mObjects.end(), obj) == mgr.mObjects.end())
+ obj->mGLTFAsset->mPendingBuffers--;
+
+
+ if (obj->mGLTFAsset->mPendingBuffers == 0)
{
- GLTFSceneManager::instance().mObjects.push_back(obj);
+ if (obj->mGLTFAsset->prep())
+ {
+ GLTFSceneManager& mgr = GLTFSceneManager::instance();
+ if (std::find(mgr.mObjects.begin(), mgr.mObjects.end(), obj) == mgr.mObjects.end())
+ {
+ GLTFSceneManager::instance().mObjects.push_back(obj);
+ }
+ }
+ else
+ {
+ LL_WARNS("GLTF") << "Failed to prepare GLTF asset: " << id << LL_ENDL;
+ obj->mGLTFAsset = nullptr;
+ }
}
}
- else
- {
- LL_WARNS("GLTF") << "Failed to prepare GLTF asset: " << id << LL_ENDL;
- obj->mGLTFAsset = nullptr;
- }
}
}
- }
- }
- else
- {
- LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << LL_ENDL;
- obj->unref();
- }
+ else
+ {
+ LL_WARNS("GLTF") << "Failed to load GLTF asset: " << id << LL_ENDL;
+ obj->unref();
+ }
+ });
}
//static
diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh
index eb3ead433b..a027aaf6d1 100755
--- a/indra/newview/linux_tools/wrapper.sh
+++ b/indra/newview/linux_tools/wrapper.sh
@@ -58,21 +58,14 @@ fi
## - Avoids an often-buggy X feature that doesn't really benefit us anyway.
export SDL_VIDEO_X11_DGAMOUSE=0
-## - Works around a problem with misconfigured 64-bit systems not finding GL
-I386_MULTIARCH="$(dpkg-architecture -ai386 -qDEB_HOST_MULTIARCH 2>/dev/null)"
-MULTIARCH_ERR=$?
-if [ $MULTIARCH_ERR -eq 0 ]; then
- echo 'Multi-arch support detected.'
- MULTIARCH_GL_DRIVERS="/usr/lib/${I386_MULTIARCH}/dri"
- export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}:${MULTIARCH_GL_DRIVERS}:/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri"
-else
- export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}:/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri"
-fi
-
## - The 'scim' GTK IM module widely crashes the viewer. Avoid it.
if [ "$GTK_IM_MODULE" = "scim" ]; then
export GTK_IM_MODULE=xim
fi
+if [ "$XMODIFIERS" = "" ]; then
+ ## IME is valid only for fcitx, not when using ibus
+ export XMODIFIERS="@im=fcitx"
+fi
## - Automatically work around the ATI mouse cursor crash bug:
## (this workaround is disabled as most fglrx users do not see the bug)
@@ -98,25 +91,6 @@ cd "${RUN_PATH}"
## Before we mess with LD_LIBRARY_PATH, save the old one to restore for
## subprocesses that care.
export SAVED_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
-
-# if [ -n "$LL_TCMALLOC" ]; then
-# tcmalloc_libs='/usr/lib/libtcmalloc.so.0 /usr/lib/libstacktrace.so.0 /lib/libpthread.so.0'
-# all=1
-# for f in $tcmalloc_libs; do
-# if [ ! -f $f ]; then
-# all=0
-# fi
-# done
-# if [ $all != 1 ]; then
-# echo 'Cannot use tcmalloc libraries: components missing' 1>&2
-# else
-# export LD_PRELOAD=$(echo $tcmalloc_libs | tr ' ' :)
-# if [ -z "$HEAPCHECK" -a -z "$HEAPPROFILE" ]; then
-# export HEAPCHECK=${HEAPCHECK:-normal}
-# fi
-# fi
-#fi
-
export LD_LIBRARY_PATH="$PWD/lib:${LD_LIBRARY_PATH}"
# Copy "$@" to ARGS array specifically to delete the --skip-gridargs switch.
@@ -140,18 +114,6 @@ LL_RUN_ERR=$?
if [ $LL_RUN_ERR -ne 0 ]; then
# generic error running the binary
echo '*** Bad shutdown ($LL_RUN_ERR). ***'
- if [ "$(uname -m)" = "x86_64" ]; then
- echo
- cat << EOFMARKER
-You are running the Second Life Viewer on a x86_64 platform. The
-most common problems when launching the Viewer (particularly
-'bin/do-not-directly-run-secondlife-bin: not found' and 'error while
-loading shared libraries') may be solved by installing your Linux
-distribution's 32-bit compatibility packages.
-For example, on Ubuntu and other Debian-based Linuxes you might run:
-$ sudo apt-get install ia32-libs ia32-libs-gtk ia32-libs-kde ia32-libs-sdl
-EOFMARKER
- fi
fi
echo
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 7c37cc1c00..c8b0adbaf8 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -439,8 +439,6 @@ LLAgent::LLAgent() :
mIsDoNotDisturb(false),
mControlFlags(0x00000000),
- mbFlagsDirty(false),
- mbFlagsNeedReset(false),
mAutoPilot(false),
mAutoPilotFlyOnStop(false),
@@ -936,8 +934,6 @@ void LLAgent::setFlying(bool fly, bool fail_sound)
// Update Movement Controls according to Fly mode
LLFloaterMove::setFlyingMode(fly);
-
- mbFlagsDirty = true;
}
@@ -1068,7 +1064,6 @@ void LLAgent::setRegion(LLViewerRegion *regionp)
{
regionp->setCapabilitiesReceivedCallback(LLAgent::capabilityReceivedCallback);
}
-
}
else
{
@@ -1556,7 +1551,6 @@ U32 LLAgent::getControlFlags()
void LLAgent::setControlFlags(U32 mask)
{
mControlFlags |= mask;
- mbFlagsDirty = true;
}
@@ -1565,28 +1559,7 @@ void LLAgent::setControlFlags(U32 mask)
//-----------------------------------------------------------------------------
void LLAgent::clearControlFlags(U32 mask)
{
- U32 old_flags = mControlFlags;
mControlFlags &= ~mask;
- if (old_flags != mControlFlags)
- {
- mbFlagsDirty = true;
- }
-}
-
-//-----------------------------------------------------------------------------
-// controlFlagsDirty()
-//-----------------------------------------------------------------------------
-bool LLAgent::controlFlagsDirty() const
-{
- return mbFlagsDirty;
-}
-
-//-----------------------------------------------------------------------------
-// enableControlFlagReset()
-//-----------------------------------------------------------------------------
-void LLAgent::enableControlFlagReset()
-{
- mbFlagsNeedReset = true;
}
//-----------------------------------------------------------------------------
@@ -1594,14 +1567,9 @@ void LLAgent::enableControlFlagReset()
//-----------------------------------------------------------------------------
void LLAgent::resetControlFlags()
{
- if (mbFlagsNeedReset)
- {
- mbFlagsNeedReset = false;
- mbFlagsDirty = false;
- // reset all of the ephemeral flags
- // some flags are managed elsewhere
- mControlFlags &= AGENT_CONTROL_AWAY | AGENT_CONTROL_FLY | AGENT_CONTROL_MOUSELOOK;
- }
+ // reset all of the ephemeral flags
+ // some flags are managed elsewhere
+ mControlFlags &= AGENT_CONTROL_AWAY | AGENT_CONTROL_FLY | AGENT_CONTROL_MOUSELOOK;
}
//-----------------------------------------------------------------------------
@@ -2085,11 +2053,19 @@ void LLAgent::propagate(const F32 dt)
}
// handle rotation based on keyboard levels
- const F32 YAW_RATE = 90.f * DEG_TO_RAD; // radians per second
- yaw(YAW_RATE * gAgentCamera.getYawKey() * dt);
+ constexpr F32 YAW_RATE = 90.f * DEG_TO_RAD; // radians per second
+ F32 angle = YAW_RATE * gAgentCamera.getYawKey() * dt;
+ if (fabs(angle) > 0.0f)
+ {
+ yaw(angle);
+ }
- const F32 PITCH_RATE = 90.f * DEG_TO_RAD; // radians per second
- pitch(PITCH_RATE * gAgentCamera.getPitchKey() * dt);
+ constexpr F32 PITCH_RATE = 90.f * DEG_TO_RAD; // radians per second
+ angle = PITCH_RATE * gAgentCamera.getPitchKey() * dt;
+ if (fabs(angle) > 0.0f)
+ {
+ pitch(angle);
+ }
// handle auto-land behavior
if (isAgentAvatarValid())
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 7c7f7aa91d..afc34f747f 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -482,21 +482,17 @@ public:
void setControlFlags(U32 mask); // Performs bitwise mControlFlags |= mask
void clearControlFlags(U32 mask); // Performs bitwise mControlFlags &= ~mask
bool controlFlagsDirty() const;
- void enableControlFlagReset();
void resetControlFlags();
bool anyControlGrabbed() const; // True iff a script has taken over a control
bool isControlGrabbed(S32 control_index) const;
// Send message to simulator to force grabbed controls to be
// released, in case of a poorly written script.
void forceReleaseControls();
- void setFlagsDirty() { mbFlagsDirty = true; }
private:
S32 mControlsTakenCount[TOTAL_CONTROLS];
S32 mControlsTakenPassedOnCount[TOTAL_CONTROLS];
U32 mControlFlags; // Replacement for the mFooKey's
- bool mbFlagsDirty;
- bool mbFlagsNeedReset; // ! HACK ! For preventing incorrect flags sent when crossing region boundaries
//--------------------------------------------------------------------
// Animations
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index e7531f963b..81e79a2ed9 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -2204,10 +2204,6 @@ void LLAgentCamera::changeCameraToMouselook(bool animate)
mCameraMode = CAMERA_MODE_MOUSELOOK;
const U32 old_flags = gAgent.getControlFlags();
gAgent.setControlFlags(AGENT_CONTROL_MOUSELOOK);
- if (old_flags != gAgent.getControlFlags())
- {
- gAgent.setFlagsDirty();
- }
if (animate)
{
diff --git a/indra/newview/llaisapi.cpp b/indra/newview/llaisapi.cpp
index ce4e8e9392..11c5ffecb6 100644
--- a/indra/newview/llaisapi.cpp
+++ b/indra/newview/llaisapi.cpp
@@ -1385,8 +1385,6 @@ void AISUpdate::parseCategory(const LLSD& category_map, S32 depth)
&& curr_cat->getVersion() > LLViewerInventoryCategory::VERSION_UNKNOWN
&& version > curr_cat->getVersion())
{
- // Potentially should new_cat->setVersion(unknown) here,
- // but might be waiting for a callback that would increment
LL_DEBUGS("Inventory") << "Category " << category_id
<< " is stale. Known version: " << curr_cat->getVersion()
<< " server version: " << version << LL_ENDL;
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index dbbc7541cc..295e22777e 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -649,8 +649,6 @@ LLAppViewer::LLAppViewer()
mQuitRequested(false),
mClosingFloaters(false),
mLogoutRequestSent(false),
- mLastAgentControlFlags(0),
- mLastAgentForceUpdate(0),
mMainloopTimeout(NULL),
mAgentRegionLastAlive(false),
mRandomizeFramerate(LLCachedControl<bool>(gSavedSettings,"Randomize Framerate", false)),
@@ -1148,7 +1146,7 @@ bool LLAppViewer::init()
gGLActive = false;
-#if LL_RELEASE_FOR_DOWNLOAD
+#if LL_RELEASE_FOR_DOWNLOAD && !LL_LINUX
// Skip updater if this is a non-interactive instance
if (!gSavedSettings.getBOOL("CmdLineSkipUpdater") && !gNonInteractive)
{
@@ -2424,6 +2422,14 @@ void LLAppViewer::initLoggingAndGetLastDuration()
{
LL_WARNS("MarkerFile") << duration_log_msg << LL_ENDL;
}
+
+ std::string user_data_path_cef_log = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "cef.log");
+ if (gDirUtilp->fileExists(user_data_path_cef_log))
+ {
+ std::string user_data_path_cef_old = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "cef.old");
+ LLFile::remove(user_data_path_cef_old, ENOENT);
+ LLFile::rename(user_data_path_cef_log, user_data_path_cef_old);
+ }
}
}
@@ -3050,9 +3056,10 @@ void LLAppViewer::initStrings()
std::string strings_path_full = gDirUtilp->findSkinnedFilenameBaseLang(LLDir::XUI, strings_file);
if (strings_path_full.empty() || !LLFile::isfile(strings_path_full))
{
+ std::string crash_reason;
if (strings_path_full.empty())
{
- LL_WARNS() << "The file '" << strings_file << "' is not found" << LL_ENDL;
+ crash_reason = "The file '" + strings_file + "' is not found";
}
else
{
@@ -3060,24 +3067,23 @@ void LLAppViewer::initStrings()
int rc = LLFile::stat(strings_path_full, &st);
if (rc != 0)
{
- LL_WARNS() << "The file '" << strings_path_full << "' failed to get status. Error code: " << rc << LL_ENDL;
+ crash_reason = "The file '" + strings_path_full + "' failed to get status. Error code: " + std::to_string(rc);
}
else if (S_ISDIR(st.st_mode))
{
- LL_WARNS() << "The filename '" << strings_path_full << "' is a directory name" << LL_ENDL;
+ crash_reason = "The filename '" + strings_path_full + "' is a directory name";
}
else
{
- LL_WARNS() << "The filename '" << strings_path_full << "' doesn't seem to be a regular file name" << LL_ENDL;
+ crash_reason = "The filename '" + strings_path_full + "' doesn't seem to be a regular file name";
}
}
// initial check to make sure files are there failed
gDirUtilp->dumpCurrentDirectories(LLError::LEVEL_WARN);
LLError::LLUserWarningMsg::showMissingFiles();
- LL_ERRS() << "Viewer failed to find localization and UI files."
- << " Please reinstall viewer from https://secondlife.com/support/downloads"
- << " and contact https://support.secondlife.com if issue persists after reinstall." << LL_ENDL;
+ LL_ERRS() << "Viewer failed to open some of localization and UI files."
+ << " " << crash_reason << "." << LL_ENDL;
}
LLTransUtil::parseStrings(strings_file, default_trans_args);
LLTransUtil::parseLanguageStrings("language_settings.xml");
@@ -4760,30 +4766,13 @@ void LLAppViewer::idle()
gAgent.autoPilot(&yaw);
}
- static LLFrameTimer agent_update_timer;
-
- // When appropriate, update agent location to the simulator.
- F32 agent_update_time = agent_update_timer.getElapsedTimeF32();
- F32 agent_force_update_time = mLastAgentForceUpdate + agent_update_time;
- bool timed_out = agent_update_time > (1.0f / (F32)AGENT_UPDATES_PER_SECOND);
- bool force_send =
- // if there is something to send
- (gAgent.controlFlagsDirty() && timed_out)
- // if something changed
- || (mLastAgentControlFlags != gAgent.getControlFlags())
- // keep alive
- || (agent_force_update_time > (1.0f / (F32) AGENT_FORCE_UPDATES_PER_SECOND));
- // timing out doesn't warranty that an update will be sent,
- // just that it will be checked.
- if (force_send || timed_out)
- {
- LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
- // Send avatar and camera info
- mLastAgentControlFlags = gAgent.getControlFlags();
- mLastAgentForceUpdate = force_send ? 0 : agent_force_update_time;
- send_agent_update(force_send);
- agent_update_timer.reset();
- }
+ send_agent_update(false);
+
+ // After calling send_agent_update() in the mainloop we always clear
+ // the agent's ephemeral ControlFlags (whether an AgentUpdate was
+ // actually sent or not) because these will be recomputed based on
+ // real-time key/controller input and resubmitted next frame.
+ gAgent.resetControlFlags();
}
//////////////////////////////////////
@@ -5395,11 +5384,6 @@ void LLAppViewer::idleNetwork()
}
#endif
-
-
- // we want to clear the control after sending out all necessary agent updates
- gAgent.resetControlFlags();
-
// Decode enqueued messages...
S32 remaining_possible_decodes = MESSAGE_MAX_PER_FRAME - total_decoded;
@@ -5788,4 +5772,3 @@ void LLAppViewer::metricsSend(bool enable_reporting)
// resolution in time.
gViewerAssetStats->restart();
}
-
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 7b456cc542..4ce4259ed8 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -322,8 +322,6 @@ private:
bool mQuitRequested; // User wants to quit, may have modified documents open.
bool mClosingFloaters;
bool mLogoutRequestSent; // Disconnect message sent to simulator, no longer safe to send messages to the sim.
- U32 mLastAgentControlFlags;
- F32 mLastAgentForceUpdate;
struct SettingsFiles* mSettingsLocationList;
LLWatchdogTimeout* mMainloopTimeout;
@@ -341,10 +339,6 @@ private:
bool mIsFirstRun;
};
-// consts from viewer.h
-const S32 AGENT_UPDATES_PER_SECOND = 125; // Value derived experimentally to avoid Input Delays with latest PBR-Capable Viewers when viewer FPS is highly volatile.
-const S32 AGENT_FORCE_UPDATES_PER_SECOND = 1;
-
// Globals with external linkage. From viewer.h
// *NOTE:Mani - These will be removed as the Viewer App Cleanup project continues.
//
diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index 1709970156..38f2f1ae7f 100644
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -40,17 +40,56 @@
#include <exception>
-#if LL_DBUS_ENABLED
-# include "llappviewerlinux_api_dbus.h"
-
-// regrettable hacks to give us better runtime compatibility with older systems inside llappviewerlinux_api.h:
-#define llg_return_if_fail(COND) do{if (!(COND)) return;}while(0)
-#undef g_return_if_fail
-#define g_return_if_fail(COND) llg_return_if_fail(COND)
-// The generated API
-# include "llappviewerlinux_api.h"
+#include <gio/gio.h>
+#include <resolv.h>
+
+#if (__GLIBC__*1000 + __GLIBC_MINOR__) >= 2034
+extern "C"
+{
+ int __res_nquery(res_state statep,
+ const char *dname, int qclass, int type,
+ unsigned char *answer, int anslen)
+ {
+ return res_nquery( statep, dname, qclass, type, answer, anslen );
+ }
+
+ int __dn_expand(const unsigned char *msg,
+ const unsigned char *eomorig,
+ const unsigned char *comp_dn, char *exp_dn,
+ int length)
+ {
+ return dn_expand( msg,eomorig,comp_dn,exp_dn,length);
+ }
+}
#endif
+#if LL_SEND_CRASH_REPORTS
+#include "breakpad/client/linux/handler/exception_handler.h"
+#include "breakpad/common/linux/http_upload.h"
+#include "lldir.h"
+#include "../llcrashlogger/llcrashlogger.h"
+#include "boost/json.hpp"
+#endif
+
+#define VIEWERAPI_SERVICE "com.secondlife.ViewerAppAPIService"
+#define VIEWERAPI_PATH "/com/secondlife/ViewerAppAPI"
+#define VIEWERAPI_INTERFACE "com.secondlife.ViewerAppAPI"
+
+static const char * DBUS_SERVER = "<node name=\"/com/secondlife/ViewerAppAPI\">\n"
+ " <interface name=\"com.secondlife.ViewerAppAPI\">\n"
+ " <annotation name=\"org.freedesktop.DBus.GLib.CSymbol\" value=\"viewer_app_api\"/>\n"
+ " <method name=\"GoSLURL\">\n"
+ " <annotation name=\"org.freedesktop.DBus.GLib.CSymbol\" value=\"dispatchSLURL\"/>\n"
+ " <arg type=\"s\" name=\"slurl\" direction=\"in\" />\n"
+ " </method>\n"
+ " </interface>\n"
+ "</node>";
+
+typedef struct
+{
+ GObject parent;
+} ViewerAppAPI;
+
namespace
{
int gArgC = 0;
@@ -81,6 +120,8 @@ int main( int argc, char **argv )
// install unexpected exception handler
gOldTerminateHandler = std::set_terminate(exceptionTerminateHandler);
+ unsetenv( "LD_PRELOAD" ); // <FS:ND/> Get rid of any preloading, we do not want this to happen during startup of plugins.
+
bool ok = viewer_app_ptr->init();
if(!ok)
{
@@ -114,21 +155,76 @@ LLAppViewerLinux::~LLAppViewerLinux()
{
}
-bool LLAppViewerLinux::init()
+#if LL_SEND_CRASH_REPORTS
+std::string gCrashLogger;
+std::string gVersion;
+std::string gBugsplatDB;
+std::string gCrashBehavior;
+
+static bool dumpCallback(const google_breakpad::MinidumpDescriptor& descriptor, void* context, bool succeeded)
{
- // g_thread_init() must be called before *any* use of glib, *and*
- // before any mutexes are held, *and* some of our third-party
- // libraries likes to use glib functions; in short, do this here
- // really early in app startup!
- if (!g_thread_supported ()) g_thread_init (NULL);
+ if( fork() == 0 )
+ execl( gCrashLogger.c_str(), gCrashLogger.c_str(), descriptor.path(), gVersion.c_str(), gBugsplatDB.c_str(), gCrashBehavior.c_str(), nullptr );
+ return succeeded;
+}
+void setupBreadpad()
+{
+ std::string build_data_fname(gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "build_data.json"));
+ gCrashLogger = gDirUtilp->getExpandedFilename(LL_PATH_EXECUTABLE, "linux-crash-logger.bin");
+
+ llifstream inf(build_data_fname.c_str());
+ if(!inf.is_open())
+ {
+ LL_WARNS("BUGSPLAT") << "Can't initialize BugSplat, can't read '" << build_data_fname << "'" << LL_ENDL;
+ return;
+ }
+
+ boost::json::error_code ec;
+ boost::json::value build_data = boost::json::parse(inf, ec);
+ if(ec.failed())
+ {
+ LL_WARNS("BUGSPLAT") << "Can't initialize BugSplat, can't parse '" << build_data_fname << "': "
+ << ec.what() << LL_ENDL;
+ return;
+ }
+
+ if (!build_data.is_object() || !build_data.as_object().contains("BugSplat DB"))
+ {
+ LL_WARNS("BUGSPLAT") << "Can't initialize BugSplat, no 'BugSplat DB' entry in '" << build_data_fname
+ << "'" << LL_ENDL;
+ return;
+ }
+
+ gVersion = STRINGIZE(
+ LL_VIEWER_VERSION_MAJOR << '.' << LL_VIEWER_VERSION_MINOR << '.' << LL_VIEWER_VERSION_PATCH
+ << '.' << LL_VIEWER_VERSION_BUILD);
+
+ boost::json::value BugSplat_DB = build_data.at("BugSplat DB");
+ gBugsplatDB = boost::json::value_to<std::string>(BugSplat_DB);
+
+ LL_INFOS("BUGSPLAT") << "Initializing with crash logger: " << gCrashLogger << " database: " << gBugsplatDB << " version: " << gVersion << LL_ENDL;
+
+ google_breakpad::MinidumpDescriptor *descriptor = new google_breakpad::MinidumpDescriptor(gDirUtilp->getExpandedFilename(LL_PATH_DUMP, ""));
+ google_breakpad::ExceptionHandler *eh = new google_breakpad::ExceptionHandler(*descriptor, NULL, dumpCallback, NULL, true, -1);
+}
+#endif
+
+bool LLAppViewerLinux::init()
+{
bool success = LLAppViewer::init();
#if LL_SEND_CRASH_REPORTS
- if (success)
+ S32 nCrashSubmitBehavior = gCrashSettings.getS32("CrashSubmitBehavior");
+
+ // For the first version we just consider always send and create a nice dialog for CRASH_BEHAVIOR_ASK later.
+ if (success && nCrashSubmitBehavior != CRASH_BEHAVIOR_NEVER_SEND )
{
- LLAppViewer* pApp = LLAppViewer::instance();
- pApp->initCrashReporting();
+ if( nCrashSubmitBehavior == CRASH_BEHAVIOR_ASK )
+ gCrashBehavior = "ask";
+ else
+ gCrashBehavior = "send";
+ setupBreadpad();
}
#endif
@@ -143,7 +239,7 @@ bool LLAppViewerLinux::restoreErrorTrap()
}
/////////////////////////////////////////
-#if LL_DBUS_ENABLED
+#if LL_GLIB
typedef struct
{
@@ -153,101 +249,77 @@ typedef struct
static void viewerappapi_init(ViewerAppAPI *server);
static void viewerappapi_class_init(ViewerAppAPIClass *klass);
-///
-
-// regrettable hacks to give us better runtime compatibility with older systems in general
-static GType llg_type_register_static_simple_ONCE(GType parent_type,
- const gchar *type_name,
- guint class_size,
- GClassInitFunc class_init,
- guint instance_size,
- GInstanceInitFunc instance_init,
- GTypeFlags flags)
-{
- static GTypeInfo type_info;
- memset(&type_info, 0, sizeof(type_info));
-
- type_info.class_size = class_size;
- type_info.class_init = class_init;
- type_info.instance_size = instance_size;
- type_info.instance_init = instance_init;
-
- return g_type_register_static(parent_type, type_name, &type_info, flags);
-}
-#define llg_intern_static_string(S) (S)
-#define g_intern_static_string(S) llg_intern_static_string(S)
-#define g_type_register_static_simple(parent_type, type_name, class_size, class_init, instance_size, instance_init, flags) llg_type_register_static_simple_ONCE(parent_type, type_name, class_size, class_init, instance_size, instance_init, flags)
-
G_DEFINE_TYPE(ViewerAppAPI, viewerappapi, G_TYPE_OBJECT);
void viewerappapi_class_init(ViewerAppAPIClass *klass)
{
}
-static bool dbus_server_init = false;
-
-void viewerappapi_init(ViewerAppAPI *server)
+static void dispatchSLURL(gchar const *slurl)
{
- // Connect to the default DBUS, register our service/API.
-
- if (!dbus_server_init)
- {
- GError *error = NULL;
-
- server->connection = lldbus_g_bus_get(DBUS_BUS_SESSION, &error);
- if (server->connection)
- {
- lldbus_g_object_type_install_info(viewerappapi_get_type(), &dbus_glib_viewerapp_object_info);
+ LL_INFOS() << "Was asked to go to slurl: " << slurl << LL_ENDL;
- lldbus_g_connection_register_g_object(server->connection, VIEWERAPI_PATH, G_OBJECT(server));
+ std::string url = slurl;
+ LLMediaCtrl* web = NULL;
+ const bool trusted_browser = false;
+ LLURLDispatcher::dispatch(url, "", web, trusted_browser);
+}
- DBusGProxy *serverproxy = lldbus_g_proxy_new_for_name(server->connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS);
+static void DoMethodeCall (GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
+{
+ LL_INFOS() << "DBUS message " << method_name << " from: " << sender << " interface: " << interface_name << LL_ENDL;
+ const gchar *slurl;
- guint request_name_ret_unused;
- // akin to org_freedesktop_DBus_request_name
- if (lldbus_g_proxy_call(serverproxy, "RequestName", &error, G_TYPE_STRING, VIEWERAPI_SERVICE, G_TYPE_UINT, 0, G_TYPE_INVALID, G_TYPE_UINT, &request_name_ret_unused, G_TYPE_INVALID))
- {
- // total success.
- dbus_server_init = true;
- }
- else
- {
- LL_WARNS() << "Unable to register service name: " << error->message << LL_ENDL;
- }
+ g_variant_get (parameters, "(&s)", &slurl);
+ dispatchSLURL(slurl);
+}
- g_object_unref(serverproxy);
- }
- else
+GDBusNodeInfo *gBusNodeInfo = nullptr;
+static const GDBusInterfaceVTable interface_vtable =
{
- g_warning("Unable to connect to dbus: %s", error->message);
- }
-
- if (error)
- g_error_free(error);
- }
+ DoMethodeCall
+ };
+static void busAcquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
+ auto id = g_dbus_connection_register_object(connection,
+ VIEWERAPI_PATH,
+ gBusNodeInfo->interfaces[0],
+ &interface_vtable,
+ NULL, /* user_data */
+ NULL, /* user_data_free_func */
+ NULL); /* GError** */
+ g_assert (id > 0);
}
-gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error)
+static void nameAcquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
{
- bool success = false;
-
- LL_INFOS() << "Was asked to go to slurl: " << slurl << LL_ENDL;
+}
- std::string url = slurl;
- LLMediaCtrl* web = NULL;
- const bool trusted_browser = false;
- if (LLURLDispatcher::dispatch(url, "", web, trusted_browser))
- {
- // bring window to foreground, as it has just been "launched" from a URL
- // todo: hmm, how to get there from here?
- //xxx->mWindow->bringToFront();
- success = true;
- }
+static void nameLost(GDBusConnection *connection, const gchar *name, gpointer user_data)
+{
- *success_rtn = g_new (gboolean, 1);
- (*success_rtn)[0] = (gboolean)success;
+}
+void viewerappapi_init(ViewerAppAPI *server)
+{
+ gBusNodeInfo = g_dbus_node_info_new_for_xml (DBUS_SERVER, NULL);
+ g_assert (gBusNodeInfo != NULL);
+
+ g_bus_own_name(G_BUS_TYPE_SESSION,
+ VIEWERAPI_SERVICE,
+ G_BUS_NAME_OWNER_FLAGS_NONE,
+ busAcquired,
+ nameAcquired,
+ nameLost,
+ NULL,
+ NULL);
- return TRUE; // the invokation succeeded, even if the actual dispatch didn't.
}
///
@@ -255,13 +327,6 @@ gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **succ
//virtual
bool LLAppViewerLinux::initSLURLHandler()
{
- if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME))
- {
- return false; // failed
- }
-
- g_type_init();
-
//ViewerAppAPI *api_server = (ViewerAppAPI*)
g_object_new(viewerappapi_get_type(), NULL);
@@ -271,49 +336,49 @@ bool LLAppViewerLinux::initSLURLHandler()
//virtual
bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url)
{
- if (!grab_dbus_syms(DBUSGLIB_DYLIB_DEFAULT_NAME))
+ auto *pBus = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, nullptr);
+
+ if( !pBus )
{
- return false; // failed
+ LL_WARNS() << "Getting dbus failed." << LL_ENDL;
+ return false;
}
- bool success = false;
- DBusGConnection *bus;
- GError *error = NULL;
-
- g_type_init();
+ auto pProxy = g_dbus_proxy_new_sync(pBus, G_DBUS_PROXY_FLAGS_NONE, nullptr,
+ VIEWERAPI_SERVICE, VIEWERAPI_PATH,
+ VIEWERAPI_INTERFACE, nullptr, nullptr);
- bus = lldbus_g_bus_get (DBUS_BUS_SESSION, &error);
- if (bus)
+ if( !pProxy )
{
- gboolean rtn = FALSE;
- DBusGProxy *remote_object =
- lldbus_g_proxy_new_for_name(bus, VIEWERAPI_SERVICE, VIEWERAPI_PATH, VIEWERAPI_INTERFACE);
-
- if (lldbus_g_proxy_call(remote_object, "GoSLURL", &error,
- G_TYPE_STRING, url.c_str(), G_TYPE_INVALID,
- G_TYPE_BOOLEAN, &rtn, G_TYPE_INVALID))
- {
- success = rtn;
- }
- else
- {
- LL_INFOS() << "Call-out to other instance failed (perhaps not running): " << error->message << LL_ENDL;
- }
-
- g_object_unref(G_OBJECT(remote_object));
+ LL_WARNS() << "Cannot create new dbus proxy." << LL_ENDL;
+ g_object_unref( pBus );
+ return false;
}
- else
+
+ auto *pArgs = g_variant_new( "(s)", url.c_str() );
+ if( !pArgs )
{
- LL_WARNS() << "Couldn't connect to session bus: " << error->message << LL_ENDL;
+ LL_WARNS() << "Cannot create new variant." << LL_ENDL;
+ g_object_unref( pBus );
+ return false;
}
- if (error)
- g_error_free(error);
+ auto pRes = g_dbus_proxy_call_sync(pProxy,
+ "GoSLURL",
+ pArgs,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1, nullptr, nullptr);
- return success;
+
+
+ if( pRes )
+ g_variant_unref( pRes );
+ g_object_unref( pProxy );
+ g_object_unref( pBus );
+ return true;
}
-#else // LL_DBUS_ENABLED
+#else // LL_GLIB
bool LLAppViewerLinux::initSLURLHandler()
{
return false; // not implemented without dbus
@@ -322,7 +387,7 @@ bool LLAppViewerLinux::sendURLToOtherInstance(const std::string& url)
{
return false; // not implemented without dbus
}
-#endif // LL_DBUS_ENABLED
+#endif // LL_GLIB
void LLAppViewerLinux::initCrashReporting(bool reportFreeze)
{
@@ -338,15 +403,18 @@ void LLAppViewerLinux::initCrashReporting(bool reportFreeze)
pid_str << LLApp::getPid();
std::string logdir = gDirUtilp->getExpandedFilename(LL_PATH_DUMP, "");
std::string appname = gDirUtilp->getExecutableFilename();
+ std::string grid{ LLGridManager::getInstance()->getGridId() };
+ std::string title{ LLAppViewer::instance()->getSecondLifeTitle() };
+ std::string pidstr{ pid_str.str() };
// launch the actual crash logger
const char * cmdargv[] =
{cmd.c_str(),
"-user",
- (char*)LLGridManager::getInstance()->getGridId().c_str(),
+ grid.c_str(),
"-name",
- LLAppViewer::instance()->getSecondLifeTitle().c_str(),
+ title.c_str(),
"-pid",
- pid_str.str().c_str(),
+ pidstr.c_str(),
"-dumpdir",
logdir.c_str(),
"-procname",
diff --git a/indra/newview/llappviewerlinux.h b/indra/newview/llappviewerlinux.h
index dde223878d..460ca721f1 100644
--- a/indra/newview/llappviewerlinux.h
+++ b/indra/newview/llappviewerlinux.h
@@ -27,17 +27,6 @@
#ifndef LL_LLAPPVIEWERLINUX_H
#define LL_LLAPPVIEWERLINUX_H
-extern "C" {
-# include <glib.h>
-}
-
-#if LL_DBUS_ENABLED
-extern "C" {
-# include <glib-object.h>
-# include <dbus/dbus-glib.h>
-}
-#endif
-
#ifndef LL_LLAPPVIEWER_H
#include "llappviewer.h"
#endif
@@ -70,21 +59,4 @@ protected:
virtual bool sendURLToOtherInstance(const std::string& url);
};
-#if LL_DBUS_ENABLED
-typedef struct
-{
- GObject parent;
- DBusGConnection *connection;
-} ViewerAppAPI;
-
-extern "C" {
- gboolean viewer_app_api_GoSLURL(ViewerAppAPI *obj, gchar *slurl, gboolean **success_rtn, GError **error);
-}
-
-#define VIEWERAPI_SERVICE "com.secondlife.ViewerAppAPIService"
-#define VIEWERAPI_PATH "/com/secondlife/ViewerAppAPI"
-#define VIEWERAPI_INTERFACE "com.secondlife.ViewerAppAPI"
-
-#endif // LL_DBUS_ENABLED
-
#endif // LL_LLAPPVIEWERLINUX_H
diff --git a/indra/newview/llappviewerlinux_api.h b/indra/newview/llappviewerlinux_api.h
deleted file mode 100644
index 3d1324dd19..0000000000
--- a/indra/newview/llappviewerlinux_api.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* Generated by dbus-binding-tool; do not edit! */
-/**
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#ifndef __dbus_glib_marshal_viewerapp_MARSHAL_H__
-#define __dbus_glib_marshal_viewerapp_MARSHAL_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#ifdef G_ENABLE_DEBUG
-#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
-#define g_marshal_value_peek_char(v) g_value_get_char (v)
-#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
-#define g_marshal_value_peek_int(v) g_value_get_int (v)
-#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
-#define g_marshal_value_peek_long(v) g_value_get_long (v)
-#define g_marshal_value_peek_ulong(v) g_value_get_ulong (v)
-#define g_marshal_value_peek_int64(v) g_value_get_int64 (v)
-#define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v)
-#define g_marshal_value_peek_enum(v) g_value_get_enum (v)
-#define g_marshal_value_peek_flags(v) g_value_get_flags (v)
-#define g_marshal_value_peek_float(v) g_value_get_float (v)
-#define g_marshal_value_peek_double(v) g_value_get_double (v)
-#define g_marshal_value_peek_string(v) (char*) g_value_get_string (v)
-#define g_marshal_value_peek_param(v) g_value_get_param (v)
-#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
-#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
-#define g_marshal_value_peek_object(v) g_value_get_object (v)
-#else /* !G_ENABLE_DEBUG */
-/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
- * Do not access GValues directly in your code. Instead, use the
- * g_value_get_*() functions
- */
-#define g_marshal_value_peek_boolean(v) (v)->data[0].v_int
-#define g_marshal_value_peek_char(v) (v)->data[0].v_int
-#define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint
-#define g_marshal_value_peek_int(v) (v)->data[0].v_int
-#define g_marshal_value_peek_uint(v) (v)->data[0].v_uint
-#define g_marshal_value_peek_long(v) (v)->data[0].v_long
-#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
-#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
-#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
-#define g_marshal_value_peek_enum(v) (v)->data[0].v_long
-#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
-#define g_marshal_value_peek_float(v) (v)->data[0].v_float
-#define g_marshal_value_peek_double(v) (v)->data[0].v_double
-#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
-#define g_marshal_value_peek_param(v) (v)->data[0].v_pointer
-#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
-#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
-#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
-#endif /* !G_ENABLE_DEBUG */
-
-
-/* BOOLEAN:STRING,POINTER,POINTER (/tmp/dbus-binding-tool-c-marshallers.5XXD8T:1) */
-extern void dbus_glib_marshal_viewerapp_BOOLEAN__STRING_POINTER_POINTER (GClosure *closure,
- GValue *return_value,
- guint n_param_values,
- const GValue *param_values,
- gpointer invocation_hint,
- gpointer marshal_data);
-void
-dbus_glib_marshal_viewerapp_BOOLEAN__STRING_POINTER_POINTER (GClosure *closure,
- GValue *return_value,
- guint n_param_values,
- const GValue *param_values,
- gpointer invocation_hint,
- gpointer marshal_data)
-{
- typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_POINTER_POINTER) (gpointer data1,
- gpointer arg_1,
- gpointer arg_2,
- gpointer arg_3,
- gpointer data2);
- register GMarshalFunc_BOOLEAN__STRING_POINTER_POINTER callback;
- register GCClosure *cc = (GCClosure*) closure;
- register gpointer data1, data2;
- gboolean v_return;
-
- g_return_if_fail (return_value != NULL);
- g_return_if_fail (n_param_values == 4);
-
- if (G_CCLOSURE_SWAP_DATA (closure))
- {
- data1 = closure->data;
- data2 = g_value_peek_pointer (param_values + 0);
- }
- else
- {
- data1 = g_value_peek_pointer (param_values + 0);
- data2 = closure->data;
- }
- callback = (GMarshalFunc_BOOLEAN__STRING_POINTER_POINTER) (marshal_data ? marshal_data : cc->callback);
-
- v_return = callback (data1,
- g_marshal_value_peek_string (param_values + 1),
- g_marshal_value_peek_pointer (param_values + 2),
- g_marshal_value_peek_pointer (param_values + 3),
- data2);
-
- g_value_set_boolean (return_value, v_return);
-}
-
-G_END_DECLS
-
-#endif /* __dbus_glib_marshal_viewerapp_MARSHAL_H__ */
-
-#include <dbus/dbus-glib.h>
-static const DBusGMethodInfo dbus_glib_viewerapp_methods[] = {
- { (GCallback) viewer_app_api_GoSLURL, dbus_glib_marshal_viewerapp_BOOLEAN__STRING_POINTER_POINTER, 0 },
-};
-
-const DBusGObjectInfo dbus_glib_viewerapp_object_info = {
- 0,
- dbus_glib_viewerapp_methods,
- 1,
-"com.secondlife.ViewerAppAPI\0GoSLURL\0S\0slurl\0I\0s\0success_ret\0O\0F\0N\0b\0\0\0",
-"\0",
-"\0"
-};
-
diff --git a/indra/newview/llappviewerlinux_api.xml b/indra/newview/llappviewerlinux_api.xml
deleted file mode 100644
index fac35b7adc..0000000000
--- a/indra/newview/llappviewerlinux_api.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
-<!-- dbus-binding-tool -mode=glib-server llappviewerlinux_api.xml -prefix=viewerapp -output=llappviewerlinux_api.h -->
-
-<node name="/com/secondlife/ViewerAppAPI">
- <interface name="com.secondlife.ViewerAppAPI">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="viewer_app_api"/>
- <method name="GoSLURL">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="viewer_app_api_GoSLURL"/>
- <arg type="s" name="slurl" direction="in" />
- <arg type="b" name="success_ret" direction="out" />
- </method>
- </interface>
-</node>
diff --git a/indra/newview/llappviewerlinux_api_dbus.cpp b/indra/newview/llappviewerlinux_api_dbus.cpp
deleted file mode 100644
index 9aed8a98d4..0000000000
--- a/indra/newview/llappviewerlinux_api_dbus.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * @file llappviewerlinux_api_dbus.cpp
- * @brief dynamic DBus symbol-grabbing code
- *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#if LL_DBUS_ENABLED
-
-#include "linden_common.h"
-
-extern "C" {
-#include <dbus/dbus-glib.h>
-
-#include "apr_pools.h"
-#include "apr_dso.h"
-}
-
-#define DEBUGMSG(...) do { LL_DEBUGS() << llformat(__VA_ARGS__) << LL_ENDL; } while(0)
-#define INFOMSG(...) do { LL_INFOS() << llformat(__VA_ARGS__) << LL_ENDL; } while(0)
-#define WARNMSG(...) do { LL_WARNS() << llformat(__VA_ARGS__) << LL_ENDL; } while(0)
-
-#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) RTN (*ll##DBUSSYM)(__VA_ARGS__) = NULL
-#include "llappviewerlinux_api_dbus_syms_raw.inc"
-#undef LL_DBUS_SYM
-
-static bool sSymsGrabbed = false;
-static apr_pool_t *sSymDBUSDSOMemoryPool = NULL;
-static apr_dso_handle_t *sSymDBUSDSOHandleG = NULL;
-
-bool grab_dbus_syms(std::string dbus_dso_name)
-{
- if (sSymsGrabbed)
- {
- // already have grabbed good syms
- return true;
- }
-
- bool sym_error = false;
- bool rtn = false;
- apr_status_t rv;
- apr_dso_handle_t *sSymDBUSDSOHandle = NULL;
-
-#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{rv = apr_dso_sym((apr_dso_handle_sym_t*)&ll##DBUSSYM, sSymDBUSDSOHandle, #DBUSSYM); if (rv != APR_SUCCESS) {INFOMSG("Failed to grab symbol: %s", #DBUSSYM); if (REQUIRED) sym_error = true;} else DEBUGMSG("grabbed symbol: %s from %p", #DBUSSYM, (void*)ll##DBUSSYM);}while(0)
-
- //attempt to load the shared library
- apr_pool_create(&sSymDBUSDSOMemoryPool, NULL);
-
- if ( APR_SUCCESS == (rv = apr_dso_load(&sSymDBUSDSOHandle,
- dbus_dso_name.c_str(),
- sSymDBUSDSOMemoryPool) ))
- {
- INFOMSG("Found DSO: %s", dbus_dso_name.c_str());
-
-#include "llappviewerlinux_api_dbus_syms_raw.inc"
-
- if ( sSymDBUSDSOHandle )
- {
- sSymDBUSDSOHandleG = sSymDBUSDSOHandle;
- sSymDBUSDSOHandle = NULL;
- }
-
- rtn = !sym_error;
- }
- else
- {
- INFOMSG("Couldn't load DSO: %s", dbus_dso_name.c_str());
- rtn = false; // failure
- }
-
- if (sym_error)
- {
- WARNMSG("Failed to find necessary symbols in DBUS-GLIB libraries.");
- }
-#undef LL_DBUS_SYM
-
- sSymsGrabbed = rtn;
- return rtn;
-}
-
-
-void ungrab_dbus_syms()
-{
- // should be safe to call regardless of whether we've
- // actually grabbed syms.
-
- if ( sSymDBUSDSOHandleG )
- {
- apr_dso_unload(sSymDBUSDSOHandleG);
- sSymDBUSDSOHandleG = NULL;
- }
-
- if ( sSymDBUSDSOMemoryPool )
- {
- apr_pool_destroy(sSymDBUSDSOMemoryPool);
- sSymDBUSDSOMemoryPool = NULL;
- }
-
- // NULL-out all of the symbols we'd grabbed
-#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) do{ll##DBUSSYM = NULL;}while(0)
-#include "llappviewerlinux_api_dbus_syms_raw.inc"
-#undef LL_DBUS_SYM
-
- sSymsGrabbed = false;
-}
-
-#endif // LL_DBUS_ENABLED
diff --git a/indra/newview/llappviewerlinux_api_dbus.h b/indra/newview/llappviewerlinux_api_dbus.h
deleted file mode 100644
index 2f4492bd7a..0000000000
--- a/indra/newview/llappviewerlinux_api_dbus.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * @file llappviewerlinux_api_dbus.h
- * @brief DBus-glib symbol handling
- *
- * $LicenseInfo:firstyear=2008&license=viewerlgpl$
- * Second Life Viewer Source Code
- * Copyright (C) 2010, Linden Research, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2.1 of the License only.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-
-#if LL_DBUS_ENABLED
-
-extern "C" {
-#include <dbus/dbus-glib.h>
-}
-
-#define DBUSGLIB_DYLIB_DEFAULT_NAME "libdbus-glib-1.so.2"
-
-bool grab_dbus_syms(std::string dbus_dso_name);
-void ungrab_dbus_syms();
-
-#define LL_DBUS_SYM(REQUIRED, DBUSSYM, RTN, ...) extern RTN (*ll##DBUSSYM)(__VA_ARGS__)
-#include "llappviewerlinux_api_dbus_syms_raw.inc"
-#undef LL_DBUS_SYM
-
-#endif // LL_DBUS_ENABLED
diff --git a/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc b/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc
deleted file mode 100644
index c0548e2fba..0000000000
--- a/indra/newview/llappviewerlinux_api_dbus_syms_raw.inc
+++ /dev/null
@@ -1,9 +0,0 @@
-
-// required symbols to grab
-LL_DBUS_SYM(true, dbus_g_bus_get, DBusGConnection*, DBusBusType, GError**);
-LL_DBUS_SYM(true, dbus_g_proxy_new_for_name, DBusGProxy*, DBusGConnection*, const char *, const char*, const char*);
-LL_DBUS_SYM(true, dbus_g_proxy_call, gboolean, DBusGProxy*, const char*, GError**, GType, ...);
-LL_DBUS_SYM(true, dbus_g_object_type_install_info, void, GType, const DBusGObjectInfo*);
-LL_DBUS_SYM(true, dbus_g_connection_register_g_object, void, DBusGConnection*, const char*, GObject*);
-
-// optional symbols to grab
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index c5686f160a..ad817d5747 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -389,17 +389,10 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
}
}
-//#define DEBUGGING_SEH_FILTER 1
-#if DEBUGGING_SEH_FILTER
-# define WINMAIN DebuggingWinMain
-#else
-# define WINMAIN wWinMain
-#endif
-
-int APIENTRY WINMAIN(HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- PWSTR pCmdLine,
- int nCmdShow)
+int APIENTRY wWinMain(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ PWSTR pCmdLine,
+ int nCmdShow)
{
// Call Tracy first thing to have it allocate memory
// https://github.com/wolfpld/tracy/issues/196
@@ -548,27 +541,6 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
return 0;
}
-#if DEBUGGING_SEH_FILTER
-// The compiler doesn't like it when you use __try/__except blocks
-// in a method that uses object destructors. Go figure.
-// This winmain just calls the real winmain inside __try.
-// The __except calls our exception filter function. For debugging purposes.
-int APIENTRY wWinMain(HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- PWSTR lpCmdLine,
- int nCmdShow)
-{
- __try
- {
- WINMAIN(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
- }
- __except( viewer_windows_exception_handler( GetExceptionInformation() ) )
- {
- _tprintf( _T("Exception handled.\n") );
- }
-}
-#endif
-
void LLAppViewerWin32::disableWinErrorReporting()
{
std::string executable_name = gDirUtilp->getExecutableFilename();
diff --git a/indra/newview/llbox.cpp b/indra/newview/llbox.cpp
index dd12a02907..d0787a3902 100644
--- a/indra/newview/llbox.cpp
+++ b/indra/newview/llbox.cpp
@@ -76,16 +76,23 @@ void LLBox::renderface(S32 which_face)
{7, 4, 0, 3}
};
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
+ {
//gGL.normal3fv(&normals[which_face][0]);
- gGL.texCoord2f(1,0);
- gGL.vertex3fv(&mVertex[ faces[which_face][0] ][0]);
- gGL.texCoord2f(1,1);
- gGL.vertex3fv(&mVertex[ faces[which_face][1] ][0]);
- gGL.texCoord2f(0,1);
- gGL.vertex3fv(&mVertex[ faces[which_face][2] ][0]);
- gGL.texCoord2f(0,0);
- gGL.vertex3fv(&mVertex[ faces[which_face][3] ][0]);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3fv(&mVertex[faces[which_face][0]][0]);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex3fv(&mVertex[faces[which_face][1]][0]);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3fv(&mVertex[faces[which_face][2]][0]);
+
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3fv(&mVertex[faces[which_face][0]][0]);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3fv(&mVertex[faces[which_face][2]][0]);
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex3fv(&mVertex[faces[which_face][3]][0]);
+ }
gGL.end();
}
diff --git a/indra/newview/llchatmsgbox.cpp b/indra/newview/llchatmsgbox.cpp
index b70b3eac95..eacbb4366d 100644
--- a/indra/newview/llchatmsgbox.cpp
+++ b/indra/newview/llchatmsgbox.cpp
@@ -41,6 +41,16 @@ public:
mEditor(NULL)
{}
+ /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const
+ {
+ ChatSeparator* copy = new ChatSeparator(mStart, mEnd);
+ if (mEditor)
+ {
+ copy->mEditor = &target;
+ }
+ return copy;
+ }
+
/*virtual*/ void linkToDocument(class LLTextBase* editor)
{
mEditor = editor;
diff --git a/indra/newview/llconversationloglist.cpp b/indra/newview/llconversationloglist.cpp
index de15fba201..8376f5463c 100644
--- a/indra/newview/llconversationloglist.cpp
+++ b/indra/newview/llconversationloglist.cpp
@@ -95,6 +95,7 @@ bool LLConversationLogList::handleRightMouseDown(S32 x, S32 y, MASK mask)
{
context_menu->buildDrawLabels();
context_menu->updateParent(LLMenuGL::sMenuContainer);
+
LLMenuGL::showPopup(this, context_menu, x, y);
}
diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp
index b19b6f8dec..a1f627c8cc 100644
--- a/indra/newview/llconversationview.cpp
+++ b/indra/newview/llconversationview.cpp
@@ -313,7 +313,7 @@ void LLConversationViewSession::draw()
{
// update the rotation angle of open folder arrow
updateLabelRotation();
- drawOpenFolderArrow(default_params, sFgColor);
+ drawOpenFolderArrow();
}
LLView::draw();
}
diff --git a/indra/newview/lldirpicker.cpp b/indra/newview/lldirpicker.cpp
index 1423ca1b9b..51157fa430 100644
--- a/indra/newview/lldirpicker.cpp
+++ b/indra/newview/lldirpicker.cpp
@@ -35,12 +35,17 @@
#include "lltrans.h"
#include "llwindow.h" // beforeDialog()
#include "llviewercontrol.h"
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#if LL_LINUX || LL_DARWIN
# include "llfilepicker.h"
#endif
+#ifdef LL_FLTK
+ #include "FL/Fl.H"
+ #include "FL/Fl_Native_File_Chooser.H"
+#endif
+
#if LL_WINDOWS
#include <shlobj.h>
#endif
@@ -214,20 +219,28 @@ LLDirPicker::LLDirPicker() :
mFileName(NULL),
mLocked(false)
{
+#ifndef LL_FLTK
mFilePicker = new LLFilePicker();
+#endif
reset();
}
LLDirPicker::~LLDirPicker()
{
+#ifndef LL_FLTK
delete mFilePicker;
+#endif
}
void LLDirPicker::reset()
{
+#ifndef LL_FLTK
if (mFilePicker)
mFilePicker->reset();
+#else
+ mDir = "";
+#endif
}
bool LLDirPicker::getDir(std::string* filename, bool blocking)
@@ -240,33 +253,39 @@ bool LLDirPicker::getDir(std::string* filename, bool blocking)
return false;
}
-#if !LL_MESA_HEADLESS
-
- if (mFilePicker)
+#ifdef LL_FLTK
+ gViewerWindow->getWindow()->beforeDialog();
+ Fl_Native_File_Chooser flDlg;
+ flDlg.title(LLTrans::getString("choose_the_directory").c_str());
+ flDlg.type(Fl_Native_File_Chooser::BROWSE_DIRECTORY );
+ int res = flDlg.show();
+ gViewerWindow->getWindow()->afterDialog();
+ if( res == 0 )
{
- GtkWindow* picker = mFilePicker->buildFilePicker(false, true,
- "dirpicker");
-
- if (picker)
- {
- gtk_window_set_title(GTK_WINDOW(picker), LLTrans::getString("choose_the_directory").c_str());
- gtk_widget_show_all(GTK_WIDGET(picker));
- gtk_main();
- return (!mFilePicker->getFirstFile().empty());
- }
+ char const *pDir = flDlg.filename(0);
+ if( pDir )
+ mDir = pDir;
}
-#endif // !LL_MESA_HEADLESS
-
+ else if( res == -1 )
+ {
+ LL_WARNS() << "FLTK failed: " << flDlg.errmsg() << LL_ENDL;
+ }
+ return !mDir.empty();
+#endif
return false;
}
std::string LLDirPicker::getDirName()
{
+#ifndef LL_FLTK
if (mFilePicker)
{
return mFilePicker->getFirstFile();
}
return "";
+#else
+ return mDir;
+#endif
}
#else // not implemented
diff --git a/indra/newview/lldirpicker.h b/indra/newview/lldirpicker.h
index dc740caab2..2ac3db7c2e 100644
--- a/indra/newview/lldirpicker.h
+++ b/indra/newview/lldirpicker.h
@@ -77,8 +77,10 @@ private:
#if LL_LINUX || LL_DARWIN
// On Linux we just implement LLDirPicker on top of LLFilePicker
+#ifndef LL_FLTK
LLFilePicker *mFilePicker;
#endif
+#endif
std::string* mFileName;
diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp
index fe6cd4e37d..33325e352f 100644
--- a/indra/newview/lldynamictexture.cpp
+++ b/indra/newview/lldynamictexture.cpp
@@ -191,44 +191,42 @@ bool LLViewerDynamicTexture::updateAllInstances()
return true;
}
- LLRenderTarget& bake_target = gPipeline.mAuxillaryRT.deferredScreen;
-
- if (!bake_target.isComplete())
+ LLRenderTarget& preview_target = gPipeline.mAuxillaryRT.deferredScreen;
+ LLRenderTarget& bake_target = gPipeline.mBakeMap;
+ if (!preview_target.isComplete() || !bake_target.isComplete())
{
llassert(false);
return false;
}
- llassert(bake_target.getWidth() >= LLPipeline::MAX_BAKE_WIDTH);
- llassert(bake_target.getHeight() >= LLPipeline::MAX_BAKE_WIDTH);
+ llassert(preview_target.getWidth() >= LLPipeline::MAX_PREVIEW_WIDTH);
+ llassert(preview_target.getHeight() >= LLPipeline::MAX_PREVIEW_WIDTH);
+ llassert(bake_target.getWidth() >= (U32) LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH);
+ llassert(bake_target.getHeight() >= (U32) LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT);
- bake_target.bindTarget();
- bake_target.clear();
+ preview_target.bindTarget();
+ preview_target.clear();
LLGLSLShader::unbind();
LLVertexBuffer::unbind();
bool result = false;
bool ret = false ;
- for( S32 order = 0; order < ORDER_COUNT; order++ )
- {
- for (instance_list_t::iterator iter = LLViewerDynamicTexture::sInstances[order].begin();
- iter != LLViewerDynamicTexture::sInstances[order].end(); ++iter)
+ auto update_func = [&](LLViewerDynamicTexture* dynamicTexture, LLRenderTarget& renderTarget, S32 width, S32 height)
{
- LLViewerDynamicTexture *dynamicTexture = *iter;
if (dynamicTexture->needsRender())
{
- llassert(dynamicTexture->getFullWidth() <= S32(LLPipeline::MAX_BAKE_WIDTH));
- llassert(dynamicTexture->getFullHeight() <= S32(LLPipeline::MAX_BAKE_WIDTH));
+ llassert(dynamicTexture->getFullWidth() <= width);
+ llassert(dynamicTexture->getFullHeight() <= height);
glClear(GL_DEPTH_BUFFER_BIT);
- gGL.color4f(1,1,1,1);
- dynamicTexture->setBoundTarget(&bake_target);
+ gGL.color4f(1.f, 1.f, 1.f, 1.f);
+ dynamicTexture->setBoundTarget(&renderTarget);
dynamicTexture->preRender(); // Must be called outside of startRender()
result = false;
if (dynamicTexture->render())
{
- ret = true ;
+ ret = true;
result = true;
sNumRenders++;
}
@@ -237,9 +235,31 @@ bool LLViewerDynamicTexture::updateAllInstances()
dynamicTexture->setBoundTarget(nullptr);
dynamicTexture->postRender(result);
}
+ };
+
+ // ORDER_FIRST is unused, ORDER_MIDDLE is various ui preview
+ for(S32 order = 0; order < ORDER_LAST; ++order)
+ {
+ for (LLViewerDynamicTexture* dynamicTexture : LLViewerDynamicTexture::sInstances[order])
+ {
+ update_func(dynamicTexture, preview_target, LLPipeline::MAX_PREVIEW_WIDTH, LLPipeline::MAX_PREVIEW_WIDTH);
}
}
+ preview_target.flush();
+
+ // ORDER_LAST is baked skin preview, ORDER_RESET resets appearance parameters and does not render.
+ bake_target.bindTarget();
+ bake_target.clear();
+ result = false;
+ ret = false;
+ for (S32 order = ORDER_LAST; order < ORDER_COUNT; ++order)
+ {
+ for (LLViewerDynamicTexture* dynamicTexture : LLViewerDynamicTexture::sInstances[order])
+ {
+ update_func(dynamicTexture, bake_target, LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH, LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT);
+ }
+ }
bake_target.flush();
gGL.flush();
diff --git a/indra/newview/llenvironment.cpp b/indra/newview/llenvironment.cpp
index 0b4630dfc3..05bd704556 100644
--- a/indra/newview/llenvironment.cpp
+++ b/indra/newview/llenvironment.cpp
@@ -453,11 +453,11 @@ namespace
void applyInjections(LLSettingsBase::Seconds delta)
{
- this->mSettings = this->mSource->getSettings();
+ LLSD settings = this->mSource->cloneSettings();
for (auto ito = mOverrideValues.beginMap(); ito != mOverrideValues.endMap(); ++ito)
{
- this->mSettings[(*ito).first] = (*ito).second;
+ settings[(*ito).first] = (*ito).second;
}
const LLSettingsBase::stringset_t &slerps = this->getSlerpKeys();
@@ -469,7 +469,7 @@ namespace
{
std::string key_name = (*it)->mKeyName;
- LLSD value = this->mSettings[key_name];
+ LLSD value = settings[key_name];
LLSD target = (*it)->mValue;
if ((*it)->mFirstTime)
@@ -485,11 +485,11 @@ namespace
{
mOverrideValues[key_name] = target;
mOverrideExps[key_name] = (*it)->mExperience;
- this->mSettings[key_name] = target;
+ settings[key_name] = target;
}
else
{
- this->mSettings.erase(key_name);
+ settings.erase(key_name);
}
}
else if (specials.find(key_name) != specials.end())
@@ -500,8 +500,8 @@ namespace
{
if (!(*it)->mBlendIn)
mix = 1.0 - mix;
- (*it)->mLastValue = this->interpolateSDValue(key_name, value, target, this->getParameterMap(), mix, slerps);
- this->mSettings[key_name] = (*it)->mLastValue;
+ (*it)->mLastValue = this->interpolateSDValue(key_name, value, target, this->getParameterMap(), mix, skips, slerps);
+ settings[key_name] = (*it)->mLastValue;
}
}
@@ -520,7 +520,7 @@ namespace
{
mInjections.erase(mInjections.begin(), mInjections.end());
}
-
+ this->setSettings(settings);
}
bool hasInjections() const
@@ -685,7 +685,8 @@ namespace
if (!injection->mBlendIn)
mix = 1.0 - mix;
stringset_t dummy;
- F64 value = this->mSettings[injection->mKeyName].asReal();
+ LLSD settings = this->cloneSettings();
+ F64 value = settings[injection->mKeyName].asReal();
if (this->getCloudNoiseTextureId().isNull())
{
value = 0; // there was no texture so start from zero coverage
@@ -695,7 +696,8 @@ namespace
// with different transitions, don't ignore it
F64 result = lerp((F32)value, (F32)injection->mValue.asReal(), (F32)mix);
injection->mLastValue = LLSD::Real(result);
- this->mSettings[injection->mKeyName] = injection->mLastValue;
+ settings[injection->mKeyName] = injection->mLastValue;
+ this->setSettings(settings);
}
// Unfortunately I don't have a per texture blend factor. We'll just pick the one that is furthest along.
@@ -1740,90 +1742,9 @@ void LLEnvironment::updateGLVariablesForSettings(LLShaderUniforms* uniforms, con
{
uniforms[i].clear();
}
-
- LLShaderUniforms* shader = &uniforms[LLGLSLShader::SG_ANY];
- //_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL;
- LLSettingsBase::parammapping_t params = psetting->getParameterMap();
- for (auto &it: params)
- {
- LLSD value;
- // legacy first since it contains ambient color and we prioritize value from legacy, see getAmbientColor()
- if (psetting->mSettings.has(LLSettingsSky::SETTING_LEGACY_HAZE) && psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE].has(it.first))
- {
- value = psetting->mSettings[LLSettingsSky::SETTING_LEGACY_HAZE][it.first];
- }
- else if (psetting->mSettings.has(it.first))
- {
- value = psetting->mSettings[it.first];
- }
- else
- {
- // We need to reset shaders, use defaults
- value = it.second.getDefaultValue();
- }
-
- LLSD::Type setting_type = value.type();
- stop_glerror();
- switch (setting_type)
- {
- case LLSD::TypeInteger:
- shader->uniform1i(it.second.getShaderKey(), value.asInteger());
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- break;
- case LLSD::TypeReal:
- shader->uniform1f(it.second.getShaderKey(), (F32)value.asReal());
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- break;
-
- case LLSD::TypeBoolean:
- shader->uniform1i(it.second.getShaderKey(), value.asBoolean() ? 1 : 0);
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << value << LL_ENDL;
- break;
-
- case LLSD::TypeArray:
- {
- LLVector4 vect4(value);
- // always identify as a radiance pass if desaturating irradiance is disabled
- static LLCachedControl<bool> desaturate_irradiance(gSavedSettings, "RenderDesaturateIrradiance", true);
-
- if (desaturate_irradiance && gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass())
- { // maximize and remove tinting if this is an irradiance map render pass and the parameter feeds into the sky background color
- auto max_vec = [](LLVector4 col)
- {
- LLColor3 color(col);
- F32 h, s, l;
- color.calcHSL(&h, &s, &l);
-
- col.mV[0] = col.mV[1] = col.mV[2] = l;
- return col;
- };
-
- switch (it.second.getShaderKey())
- {
- case LLShaderMgr::BLUE_HORIZON:
- case LLShaderMgr::BLUE_DENSITY:
- vect4 = max_vec(vect4);
- break;
- }
- }
-
- //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL;
- shader->uniform3fv(it.second.getShaderKey(), LLVector3(vect4.mV) );
- break;
- }
-
- // case LLSD::TypeMap:
- // case LLSD::TypeString:
- // case LLSD::TypeUUID:
- // case LLSD::TypeURI:
- // case LLSD::TypeBinary:
- // case LLSD::TypeDate:
- default:
- break;
- }
- }
//_WARNS("RIDER") << "----------------------------------------------------------------" << LL_ENDL;
+ psetting->applyToUniforms(uniforms);
psetting->applySpecial(uniforms);
}
diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp
index 748e10160c..5c46eb9d80 100644
--- a/indra/newview/llexpandabletextbox.cpp
+++ b/indra/newview/llexpandabletextbox.cpp
@@ -44,6 +44,14 @@ public:
mExpanderLabel(utf8str_to_wstring(more_text))
{}
+ /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const
+ {
+ LLStyleSP sp(cloneStyle(target, mStyle));
+ LLExpanderSegment* copy = new LLExpanderSegment(sp, mStart, mEnd, LLStringUtil::null, target);
+ copy->mExpanderLabel = mExpanderLabel;
+ return copy;
+ }
+
/*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const
{
// more label always spans width of text box
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index 48fddc32db..f3cb07739d 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -56,12 +56,7 @@
#include "llvoavatar.h"
#include "llsculptidsize.h"
#include "llmeshrepository.h"
-
-#if LL_LINUX
-// Work-around spurious used before init warning on Vector4a
-//
-#pragma GCC diagnostic ignored "-Wuninitialized"
-#endif
+#include "llskinningutil.h"
#define LL_MAX_INDICES_COUNT 1000000
@@ -841,7 +836,6 @@ bool LLFace::genVolumeBBoxes(const LLVolume &volume, S32 f,
//VECTORIZE THIS
LLMatrix4a mat_vert;
mat_vert.loadu(mat_vert_in);
- LLVector4a new_extents[2];
llassert(less_than_max_mag(face.mExtents[0]));
llassert(less_than_max_mag(face.mExtents[1]));
@@ -2184,28 +2178,96 @@ F32 LLFace::getTextureVirtualSize()
bool LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
{
+ constexpr F32 PIXEL_AREA_UPDATE_PERIOD = 0.1f;
+ // this is an expensive operation and the result is valid (enough) for several frames
+ // don't update every frame
+ if (gFrameTimeSeconds - mLastPixelAreaUpdate < PIXEL_AREA_UPDATE_PERIOD)
+ {
+ return true;
+ }
+
LL_PROFILE_ZONE_SCOPED_CATEGORY_FACE;
//get area of circle around face
-
LLVector4a center;
LLVector4a size;
-
if (isState(LLFace::RIGGED))
{
- //override with avatar bounding box
+ LL_PROFILE_ZONE_NAMED_CATEGORY_FACE("calcPixelArea - rigged");
+ //override with joint volume face joint bounding boxes
LLVOAvatar* avatar = mVObjp->getAvatar();
+ bool hasRiggedExtents = false;
+
if (avatar && avatar->mDrawable)
{
- center.load3(avatar->getPositionAgent().mV);
- const LLVector4a* exts = avatar->mDrawable->getSpatialExtents();
- size.setSub(exts[1], exts[0]);
+ LLVolume* volume = mVObjp->getVolume();
+ if (volume)
+ {
+ LLVolumeFace& face = volume->getVolumeFace(mTEOffset);
+
+ auto& rigInfo = face.mJointRiggingInfoTab;
+
+ if (rigInfo.needsUpdate())
+ {
+ LLVOVolume* vo_volume = (LLVOVolume*)mVObjp.get();
+ LLVOAvatar* avatar = mVObjp->getAvatar();
+ const LLMeshSkinInfo* skin = vo_volume->getSkinInfo();
+ LLSkinningUtil::updateRiggingInfo(skin, avatar, face);
+ }
+
+ // calculate the world space bounding box of the face by combining the bounding boxes of all the joints
+ LLVector4a& minp = mRiggedExtents[0];
+ LLVector4a& maxp = mRiggedExtents[1];
+ minp = LLVector4a(FLT_MAX, FLT_MAX, FLT_MAX);
+ maxp = LLVector4a(-FLT_MAX, -FLT_MAX, -FLT_MAX);
+
+ for (S32 i = 0; i < rigInfo.size(); i++)
+ {
+ auto& jointInfo = rigInfo[i];
+ if (jointInfo.isRiggedTo())
+ {
+ LLJoint* joint = avatar->getJoint(i);
+
+ if (joint)
+ {
+ LLVector4a jointPos;
+
+ LLMatrix4a worldMat;
+ worldMat.loadu((F32*)&joint->getWorldMatrix().mMatrix[0][0]);
+
+ LLVector4a extents[2];
+
+ matMulBoundBox(worldMat, jointInfo.getRiggedExtents(), extents);
+
+ minp.setMin(minp, extents[0]);
+ maxp.setMax(maxp, extents[1]);
+ hasRiggedExtents = true;
+ }
+ }
+ }
+ }
}
- else
+
+ if (!hasRiggedExtents)
{
+ // no rigged extents, zero out bounding box and skip update
+ mRiggedExtents[0] = mRiggedExtents[1] = LLVector4a(0.f, 0.f, 0.f);
+
return false;
}
+
+ center.setAdd(mRiggedExtents[1], mRiggedExtents[0]);
+ center.mul(0.5f);
+ size.setSub(mRiggedExtents[1], mRiggedExtents[0]);
+ }
+ else if (mDrawablep && mVObjp.notNull() && mVObjp->getPartitionType() == LLViewerRegion::PARTITION_PARTICLE && mDrawablep->getSpatialGroup())
+ { // use box of spatial group for particles (over approximates size, but we don't actually have a good size per particle)
+ LLSpatialGroup* group = mDrawablep->getSpatialGroup();
+ const LLVector4a* extents = group->getExtents();
+ size.setSub(extents[1], extents[0]);
+ center.setAdd(extents[1], extents[0]);
+ center.mul(0.5f);
}
else
{
@@ -2231,6 +2293,10 @@ bool LLFace::calcPixelArea(F32& cos_angle_to_view_dir, F32& radius)
F32 app_angle = atanf((F32) sqrt(size_squared) / dist);
radius = app_angle*LLDrawable::sCurPixelAngle;
mPixelArea = radius*radius * 3.14159f;
+
+ // remember last update time, add 10% noise to avoid all faces updating at the same time
+ mLastPixelAreaUpdate = gFrameTimeSeconds + ll_frand() * PIXEL_AREA_UPDATE_PERIOD * 0.1f;
+
LLVector4a x_axis;
x_axis.load3(camera->getXAxis().mV);
cos_angle_to_view_dir = lookAt.dot3(x_axis).getF32();
diff --git a/indra/newview/llface.h b/indra/newview/llface.h
index 99642016f7..65637fbf85 100644
--- a/indra/newview/llface.h
+++ b/indra/newview/llface.h
@@ -234,8 +234,14 @@ public:
// return true if this face is in an alpha draw pool
bool isInAlphaPool() const;
public: //aligned members
+
+ // bounding box of face in drawable space
LLVector4a mExtents[2];
+ // cached bounding box of rigged face in world space
+ // calculated on-demand by LLFace::calcPixelArea and may not be up-to-date
+ LLVector4a mRiggedExtents[2] = { LLVector4a(0,0,0), LLVector4a(0,0,0) };
+
private:
friend class LLViewerTextureList;
F32 adjustPartialOverlapPixelArea(F32 cos_angle_to_view_dir, F32 radius );
@@ -301,7 +307,14 @@ private:
S32 mReferenceIndex;
std::vector<S32> mRiggedIndex;
+ // gFrameTimeSeconds when mPixelArea was last updated
+ F32 mLastPixelAreaUpdate = 0.f;
+
+ // virtual size of face in texture area (mPixelArea adjusted by texture repeats)
+ // used to determine desired resolution of texture
F32 mVSize;
+
+ // pixel area face covers on screen
F32 mPixelArea;
//importance factor, in the range [0, 1.0].
diff --git a/indra/newview/llfeaturemanager.cpp b/indra/newview/llfeaturemanager.cpp
index dded4d1e92..fcc3423b4d 100644
--- a/indra/newview/llfeaturemanager.cpp
+++ b/indra/newview/llfeaturemanager.cpp
@@ -40,6 +40,7 @@
#include "llappviewer.h"
#include "llbufferstream.h"
+#include "llexception.h"
#include "llnotificationsutil.h"
#include "llviewercontrol.h"
#include "llworld.h"
@@ -377,33 +378,6 @@ bool LLFeatureManager::parseFeatureTable(std::string filename)
F32 gpu_benchmark();
-#if LL_WINDOWS
-
-F32 logExceptionBenchmark()
-{
- // FIXME: gpu_benchmark uses many C++ classes on the stack to control state.
- // SEH exceptions with our current exception handling options do not call
- // destructors for these classes, resulting in an undefined state should
- // this handler be invoked.
- F32 gbps = -1;
- __try
- {
- gbps = gpu_benchmark();
- }
- __except (msc_exception_filter(GetExceptionCode(), GetExceptionInformation()))
- {
- // HACK - ensure that profiling is disabled
- LLGLSLShader::finishProfile();
-
- // convert to C++ styled exception
- char integer_string[32];
- sprintf(integer_string, "SEH, code: %lu\n", GetExceptionCode());
- throw std::exception(integer_string);
- }
- return gbps;
-}
-#endif
-
bool LLFeatureManager::loadGPUClass()
{
if (!gSavedSettings.getBOOL("SkipBenchmark"))
@@ -413,14 +387,12 @@ bool LLFeatureManager::loadGPUClass()
F32 gbps;
try
{
-#if LL_WINDOWS
- gbps = logExceptionBenchmark();
-#else
- gbps = gpu_benchmark();
-#endif
+ gbps = LL::seh::catcher(gpu_benchmark);
}
catch (const std::exception& e)
{
+ // HACK - ensure that profiling is disabled
+ LLGLSLShader::finishProfile();
gbps = -1.f;
LL_WARNS("RenderInit") << "GPU benchmark failed: " << e.what() << LL_ENDL;
}
@@ -656,6 +628,14 @@ void LLFeatureManager::applyBaseMasks()
{
maskFeatures("Intel");
}
+ if (gGLManager.mIsApple)
+ {
+ maskFeatures("AppleGPU");
+ }
+ else
+ {
+ maskFeatures("NonAppleGPU");
+ }
if (gGLManager.mGLVersion < 3.f)
{
maskFeatures("OpenGLPre30");
diff --git a/indra/newview/llfilepicker.h b/indra/newview/llfilepicker.h
index 09f785b921..e0bd32fe70 100644
--- a/indra/newview/llfilepicker.h
+++ b/indra/newview/llfilepicker.h
@@ -54,19 +54,8 @@
#include <commdlg.h>
#endif
-extern "C" {
-// mostly for Linux, possible on others
-#if LL_GTK
-# include "gtk/gtk.h"
-#endif // LL_GTK
-}
-
class LLFilePicker
{
-#ifdef LL_GTK
- friend class LLDirPicker;
- friend void chooser_responder(GtkWidget *, gint, gpointer);
-#endif // LL_GTK
public:
// calling this before main() is undefined
static LLFilePicker& instance( void ) { return sInstance; }
@@ -185,14 +174,12 @@ private:
void *userdata);
#endif
-#if LL_GTK
- static void add_to_selectedfiles(gpointer data, gpointer user_data);
- static void chooser_responder(GtkWidget *widget, gint response, gpointer user_data);
- // we remember the last path that was accessed for a particular usage
- std::map <std::string, std::string> mContextToPathMap;
- std::string mCurContextName;
- // we also remember the extension of the last added file.
- std::string mCurrentExtension;
+#if LL_FLTK
+ enum EType
+ {
+ eSaveFile, eOpenFile, eOpenMultiple
+ };
+ bool openFileDialog( int32_t filter, bool blocking, EType aType );
#endif
std::vector<std::string> mFiles;
@@ -201,12 +188,6 @@ private:
static LLFilePicker sInstance;
-protected:
-#if LL_GTK
- GtkWindow* buildFilePicker(bool is_save, bool is_folder,
- std::string context = "generic");
-#endif
-
public:
// don't call these directly please.
LLFilePicker();
diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index 11505e3047..a38cc94328 100644
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -163,6 +163,7 @@ public:
void updateParcelInfo();
void updateCovenantInfo();
static void onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data);
+ void updateFloaterCovenant(const LLTextBase* source, const LLUUID &asset_id);
void updateFloaterCovenantText(const std::string& string, const LLUUID &asset_id);
void updateFloaterEstateName(const std::string& name);
void updateFloaterLastModified(const std::string& text);
@@ -201,6 +202,8 @@ public:
void onVisibilityChanged ( const LLSD& new_visibility );
+private:
+ void onCovenantTextUpdated(const LLUUID& asset_id);
};
// static
@@ -222,6 +225,15 @@ void LLFloaterBuyLand::buyLand(
}
// static
+void LLFloaterBuyLand::updateCovenant(const LLTextBase* source, const LLUUID& asset_id)
+{
+ if (LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land"))
+ {
+ floater->updateFloaterCovenant(source, asset_id);
+ }
+}
+
+// static
void LLFloaterBuyLand::updateCovenantText(const std::string& string, const LLUUID &asset_id)
{
LLFloaterBuyLandUI* floater = LLFloaterReg::findTypedInstance<LLFloaterBuyLandUI>("buy_land");
@@ -560,11 +572,24 @@ void LLFloaterBuyLandUI::onChangeAgreeCovenant(LLUICtrl* ctrl, void* user_data)
}
}
+void LLFloaterBuyLandUI::updateFloaterCovenant(const LLTextBase* source, const LLUUID& asset_id)
+{
+ LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("covenant_editor");
+ editor->copyContents(source);
+
+ onCovenantTextUpdated(asset_id);
+}
+
void LLFloaterBuyLandUI::updateFloaterCovenantText(const std::string &string, const LLUUID& asset_id)
{
LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("covenant_editor");
editor->setText(string);
+ onCovenantTextUpdated(asset_id);
+}
+
+void LLFloaterBuyLandUI::onCovenantTextUpdated(const LLUUID& asset_id)
+{
LLCheckBoxCtrl* check = getChild<LLCheckBoxCtrl>("agree_covenant");
LLTextBox* box = getChild<LLTextBox>("covenant_text");
if (asset_id.isNull())
diff --git a/indra/newview/llfloaterbuyland.h b/indra/newview/llfloaterbuyland.h
index f750a4017a..732312f10f 100644
--- a/indra/newview/llfloaterbuyland.h
+++ b/indra/newview/llfloaterbuyland.h
@@ -27,6 +27,7 @@
#ifndef LL_LLFLOATERBUYLAND_H
#define LL_LLFLOATERBUYLAND_H
+class LLTextBase;
class LLFloater;
class LLViewerRegion;
class LLParcelSelection;
@@ -37,6 +38,7 @@ public:
static void buyLand(LLViewerRegion* region,
LLSafeHandle<LLParcelSelection> parcel,
bool is_for_group);
+ static void updateCovenant(const LLTextBase* source, const LLUUID& asset_id);
static void updateCovenantText(const std::string& string, const LLUUID& asset_id);
static void updateEstateName(const std::string& name);
static void updateLastModified(const std::string& text);
diff --git a/indra/newview/llfloaterbvhpreview.cpp b/indra/newview/llfloaterbvhpreview.cpp
index 3d81d01e16..b94c31ec04 100644
--- a/indra/newview/llfloaterbvhpreview.cpp
+++ b/indra/newview/llfloaterbvhpreview.cpp
@@ -406,7 +406,7 @@ void LLFloaterBvhPreview::draw()
gGL.getTexUnit(0)->bind(mAnimPreview);
- gGL.begin( LLRender::QUADS );
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
@@ -414,6 +414,11 @@ void LLFloaterBvhPreview::draw()
gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
}
diff --git a/indra/newview/llfloatercreatelandmark.cpp b/indra/newview/llfloatercreatelandmark.cpp
index 2ce8a7a212..77ea544c5d 100644
--- a/indra/newview/llfloatercreatelandmark.cpp
+++ b/indra/newview/llfloatercreatelandmark.cpp
@@ -31,6 +31,7 @@
#include "llagent.h"
#include "llagentui.h"
#include "llcombobox.h"
+#include "llfloaterreg.h"
#include "llinventoryfunctions.h"
#include "llinventoryobserver.h"
#include "lllandmarkactions.h"
@@ -286,8 +287,7 @@ void LLFloaterCreateLandmark::onCreateFolderClicked()
std::string folder_name = resp["message"].asString();
if (!folder_name.empty())
{
- inventory_func_type func = boost::bind(&LLFloaterCreateLandmark::folderCreatedCallback, this, _1);
- gInventory.createNewCategory(mLandmarksID, LLFolderType::FT_NONE, folder_name, func);
+ gInventory.createNewCategory(mLandmarksID, LLFolderType::FT_NONE, folder_name, folderCreatedCallback);
gInventory.notifyObservers();
}
}
@@ -296,7 +296,11 @@ void LLFloaterCreateLandmark::onCreateFolderClicked()
void LLFloaterCreateLandmark::folderCreatedCallback(LLUUID folder_id)
{
- populateFoldersList(folder_id);
+ LLFloaterCreateLandmark* floater = LLFloaterReg::findTypedInstance<LLFloaterCreateLandmark>("add_landmark");
+ if (floater && !floater->isDead())
+ {
+ floater->populateFoldersList(folder_id);
+ }
}
void LLFloaterCreateLandmark::onSaveClicked()
@@ -389,6 +393,7 @@ void LLFloaterCreateLandmark::setItem(const uuid_set_t& items)
{
mItem = item;
mAssetID = mItem->getAssetUUID();
+ mParentID = mItem->getParentUUID();
setVisibleAndFrontmost(true);
break;
}
@@ -418,8 +423,7 @@ void LLFloaterCreateLandmark::updateItem(const uuid_set_t& items, U32 mask)
closeFloater();
}
- LLUUID folder_id = mFolderCombo->getValue().asUUID();
- if (folder_id != mItem->getParentUUID())
+ if (mParentID != mItem->getParentUUID())
{
// user moved landmark in inventory,
// assume that we are done all other changes should already be commited
diff --git a/indra/newview/llfloatercreatelandmark.h b/indra/newview/llfloatercreatelandmark.h
index fa6d001b8e..bcf9d8578c 100644
--- a/indra/newview/llfloatercreatelandmark.h
+++ b/indra/newview/llfloatercreatelandmark.h
@@ -62,13 +62,14 @@ private:
void onSaveClicked();
void onCancelClicked();
- void folderCreatedCallback(LLUUID folder_id);
+ static void folderCreatedCallback(LLUUID folder_id);
LLComboBox* mFolderCombo;
LLLineEditor* mLandmarkTitleEditor;
LLTextEditor* mNotesEditor;
LLUUID mLandmarksID;
LLUUID mAssetID;
+ LLUUID mParentID;
LLLandmarksInventoryObserver* mInventoryObserver;
LLPointer<LLInventoryItem> mItem;
diff --git a/indra/newview/llfloateremojipicker.cpp b/indra/newview/llfloateremojipicker.cpp
index cc13e5d059..ffbda0265d 100644
--- a/indra/newview/llfloateremojipicker.cpp
+++ b/indra/newview/llfloateremojipicker.cpp
@@ -57,8 +57,7 @@ static const S32 USED_EMOJIS_IMAGE_INDEX = 0x23F2;
// https://www.compart.com/en/unicode/U+1F6D1
static const S32 EMPTY_LIST_IMAGE_INDEX = 0x1F6D1;
// The following categories should follow the required alphabetic order
-static const std::string RECENTLY_USED_CATEGORY = "1 recently used";
-static const std::string FREQUENTLY_USED_CATEGORY = "2 frequently used";
+static const std::string FREQUENTLY_USED_CATEGORY = "frequently used";
// Floater state related variables
static std::list<llwchar> sRecentlyUsed;
@@ -436,6 +435,7 @@ void LLFloaterEmojiPicker::fillGroups()
LLButton::Params params;
params.font = LLFontGL::getFontEmojiLarge();
+ params.name = "all_categories";
LLRect rect;
rect.mTop = mGroups->getRect().getHeight();
@@ -445,11 +445,10 @@ void LLFloaterEmojiPicker::fillGroups()
params.name = "all_categories";
createGroupButton(params, rect, ALL_EMOJIS_IMAGE_INDEX);
- // Create group and button for "Recently used" and/or "Frequently used"
- if (!sRecentlyUsed.empty() || !sFrequentlyUsed.empty())
+ // Create group and button for "Frequently used"
+ if (!sFrequentlyUsed.empty())
{
std::map<std::string, std::vector<LLEmojiSearchResult>> cats;
- fillCategoryRecentlyUsed(cats);
fillCategoryFrequentlyUsed(cats);
if (!cats.empty())
@@ -482,40 +481,6 @@ void LLFloaterEmojiPicker::fillGroups()
resizeGroupButtons();
}
-void LLFloaterEmojiPicker::fillCategoryRecentlyUsed(std::map<std::string, std::vector<LLEmojiSearchResult>>& cats)
-{
- if (sRecentlyUsed.empty())
- return;
-
- std::vector<LLEmojiSearchResult> emojis;
-
- // In case of empty mFilterPattern we'd use sRecentlyUsed directly
- if (!mFilterPattern.empty())
- {
- // List all emojis in "Recently used"
- const LLEmojiDictionary::emoji2descr_map_t& emoji2descr = LLEmojiDictionary::instance().getEmoji2Descr();
- std::size_t begin, end;
- for (llwchar emoji : sRecentlyUsed)
- {
- auto e2d = emoji2descr.find(emoji);
- if (e2d != emoji2descr.end() && !e2d->second->ShortCodes.empty())
- {
- for (const std::string& shortcode : e2d->second->ShortCodes)
- {
- if (LLEmojiDictionary::searchInShortCode(begin, end, shortcode, mFilterPattern))
- {
- emojis.emplace_back(emoji, shortcode, begin, end);
- }
- }
- }
- }
- if (emojis.empty())
- return;
- }
-
- cats.emplace(std::make_pair(RECENTLY_USED_CATEGORY, emojis));
-}
-
void LLFloaterEmojiPicker::fillCategoryFrequentlyUsed(std::map<std::string, std::vector<LLEmojiSearchResult>>& cats)
{
if (sFrequentlyUsed.empty())
@@ -756,7 +721,6 @@ void LLFloaterEmojiPicker::fillEmojisCategory(const std::vector<LLEmojiSearchRes
{
// Place the category title
std::string title =
- category == RECENTLY_USED_CATEGORY ? getString("title_for_recently_used") :
category == FREQUENTLY_USED_CATEGORY ? getString("title_for_frequently_used") :
isupper(category.front()) ? category : LLStringUtil::capitalize(category);
LLEmojiGridDivider* div = new LLEmojiGridDivider(row_panel_params, title);
@@ -769,21 +733,7 @@ void LLFloaterEmojiPicker::fillEmojisCategory(const std::vector<LLEmojiSearchRes
{
const LLEmojiDictionary::emoji2descr_map_t& emoji2descr = LLEmojiDictionary::instance().getEmoji2Descr();
LLEmojiSearchResult emoji { 0, "", 0, 0 };
- if (category == RECENTLY_USED_CATEGORY)
- {
- for (llwchar code : sRecentlyUsed)
- {
- const LLEmojiDictionary::emoji2descr_map_t::const_iterator& e2d = emoji2descr.find(code);
- if (e2d != emoji2descr.end() && !e2d->second->ShortCodes.empty())
- {
- emoji.Character = code;
- emoji.String = e2d->second->ShortCodes.front();
- createEmojiIcon(emoji, category, row_panel_params, row_list_params, icon_params,
- icon_rect, max_icons, bg, row, icon_index);
- }
- }
- }
- else if (category == FREQUENTLY_USED_CATEGORY)
+ if (category == FREQUENTLY_USED_CATEGORY)
{
for (const auto& code : sFrequentlyUsed)
{
diff --git a/indra/newview/llfloateremojipicker.h b/indra/newview/llfloateremojipicker.h
index 669683eb9e..b807adb67d 100644
--- a/indra/newview/llfloateremojipicker.h
+++ b/indra/newview/llfloateremojipicker.h
@@ -60,7 +60,6 @@ public:
private:
void initialize();
void fillGroups();
- void fillCategoryRecentlyUsed(std::map<std::string, std::vector<LLEmojiSearchResult>>& cats);
void fillCategoryFrequentlyUsed(std::map<std::string, std::vector<LLEmojiSearchResult>>& cats);
void fillGroupEmojis(std::map<std::string, std::vector<LLEmojiSearchResult>>& cats, U32 index);
void createGroupButton(LLButton::Params& params, const LLRect& rect, llwchar emoji);
diff --git a/indra/newview/llfloatergltfasseteditor.cpp b/indra/newview/llfloatergltfasseteditor.cpp
index f28c01d713..002fb3996f 100644
--- a/indra/newview/llfloatergltfasseteditor.cpp
+++ b/indra/newview/llfloatergltfasseteditor.cpp
@@ -209,7 +209,7 @@ void LLFloaterGLTFAssetEditor::loadFromNode(S32 node_id, LLFolderViewFolder* par
std::string name = node.mName;
if (node.mName.empty())
{
- name = getString("node_tittle");
+ name = getString("node_title");
}
else
{
@@ -243,7 +243,7 @@ void LLFloaterGLTFAssetEditor::loadFromNode(S32 node_id, LLFolderViewFolder* par
std::string name = mAsset->mMeshes[node.mMesh].mName;
if (name.empty())
{
- name = getString("mesh_tittle");
+ name = getString("mesh_title");
}
loadItem(node.mMesh, name, LLGLTFFolderItem::TYPE_MESH, view);
}
@@ -253,7 +253,7 @@ void LLFloaterGLTFAssetEditor::loadFromNode(S32 node_id, LLFolderViewFolder* par
std::string name = mAsset->mSkins[node.mSkin].mName;
if (name.empty())
{
- name = getString("skin_tittle");
+ name = getString("skin_title");
}
loadItem(node.mSkin, name, LLGLTFFolderItem::TYPE_SKIN, view);
}
@@ -306,7 +306,7 @@ void LLFloaterGLTFAssetEditor::loadFromSelection()
std::string name = scene.mName;
if (scene.mName.empty())
{
- name = getString("scene_tittle");
+ name = getString("scene_title");
}
else
{
diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp
index 711c33e73d..989e1d8d04 100644
--- a/indra/newview/llfloaterimagepreview.cpp
+++ b/indra/newview/llfloaterimagepreview.cpp
@@ -285,7 +285,7 @@ void LLFloaterImagePreview::draw()
}
gGL.color3f(1.f, 1.f, 1.f);
- gGL.begin( LLRender::QUADS );
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mTop);
gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
@@ -293,6 +293,11 @@ void LLFloaterImagePreview::draw()
gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mBottom);
gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+
+ gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mBottom);
+ gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+ gGL.texCoord2f(mPreviewImageRect.mLeft, mPreviewImageRect.mTop);
+ gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
gGL.texCoord2f(mPreviewImageRect.mRight, mPreviewImageRect.mTop);
gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
}
@@ -317,7 +322,7 @@ void LLFloaterImagePreview::draw()
gGL.getTexUnit(0)->bind(mAvatarPreview);
}
- gGL.begin( LLRender::QUADS );
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
@@ -325,6 +330,11 @@ void LLFloaterImagePreview::draw()
gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT + PREVIEW_VPAD);
}
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index bec76fe5e4..52a3e78d04 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -3124,6 +3124,16 @@ void LLPanelLandCovenant::refresh()
}
// static
+void LLPanelLandCovenant::updateCovenant(const LLTextBase* source)
+{
+ if (LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant())
+ {
+ LLViewerTextEditor* editor = self->getChild<LLViewerTextEditor>("covenant_editor");
+ editor->copyContents(source);
+ }
+}
+
+// static
void LLPanelLandCovenant::updateCovenantText(const std::string &string)
{
LLPanelLandCovenant* self = LLFloaterLand::getCurrentPanelLandCovenant();
diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h
index 95f6a44a94..8af0caab33 100644
--- a/indra/newview/llfloaterland.h
+++ b/indra/newview/llfloaterland.h
@@ -50,6 +50,7 @@ class LLRadioGroup;
class LLParcelSelectionObserver;
class LLSpinCtrl;
class LLTabContainer;
+class LLTextBase;
class LLTextBox;
class LLTextEditor;
class LLTextureCtrl;
@@ -416,6 +417,7 @@ public:
virtual ~LLPanelLandCovenant();
virtual bool postBuild();
void refresh();
+ static void updateCovenant(const LLTextBase* source);
static void updateCovenantText(const std::string& string);
static void updateEstateName(const std::string& name);
static void updateLastModified(const std::string& text);
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index 5ca727cf66..8332a430e6 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -782,16 +782,21 @@ void LLFloaterModelPreview::draw3dPreview()
gGL.getTexUnit(0)->bind(mModelPreview);
- gGL.begin( LLRender::QUADS );
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.texCoord2f(0.f, 1.f);
- gGL.vertex2i(mPreviewRect.mLeft+1, mPreviewRect.mTop-1);
+ gGL.vertex2i(mPreviewRect.mLeft + 1, mPreviewRect.mTop - 1);
gGL.texCoord2f(0.f, 0.f);
- gGL.vertex2i(mPreviewRect.mLeft+1, mPreviewRect.mBottom+1);
+ gGL.vertex2i(mPreviewRect.mLeft + 1, mPreviewRect.mBottom + 1);
gGL.texCoord2f(1.f, 0.f);
- gGL.vertex2i(mPreviewRect.mRight-1, mPreviewRect.mBottom+1);
+ gGL.vertex2i(mPreviewRect.mRight - 1, mPreviewRect.mBottom + 1);
+
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2i(mPreviewRect.mRight - 1, mPreviewRect.mBottom + 1);
gGL.texCoord2f(1.f, 1.f);
- gGL.vertex2i(mPreviewRect.mRight-1, mPreviewRect.mTop-1);
+ gGL.vertex2i(mPreviewRect.mRight - 1, mPreviewRect.mTop - 1);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2i(mPreviewRect.mLeft + 1, mPreviewRect.mTop - 1);
}
gGL.end();
diff --git a/indra/newview/llfloaterperformance.cpp b/indra/newview/llfloaterperformance.cpp
index 851e15feed..756d22eea7 100644
--- a/indra/newview/llfloaterperformance.cpp
+++ b/indra/newview/llfloaterperformance.cpp
@@ -115,12 +115,12 @@ bool LLFloaterPerformance::postBuild()
mHUDList = mHUDsPanel->getChild<LLNameListCtrl>("hud_list");
mHUDList->setNameListType(LLNameListCtrl::SPECIAL);
mHUDList->setHoverIconName("StopReload_Off");
- mHUDList->setIconClickedCallback(boost::bind(&LLFloaterPerformance::detachItem, this, _1));
+ mHUDList->setIconClickedCallback(boost::bind(&LLFloaterPerformance::detachObject, this, _1));
mObjectList = mComplexityPanel->getChild<LLNameListCtrl>("obj_list");
mObjectList->setNameListType(LLNameListCtrl::SPECIAL);
mObjectList->setHoverIconName("StopReload_Off");
- mObjectList->setIconClickedCallback(boost::bind(&LLFloaterPerformance::detachItem, this, _1));
+ mObjectList->setIconClickedCallback(boost::bind(&LLFloaterPerformance::detachObject, this, _1));
mSettingsPanel->getChild<LLButton>("advanced_btn")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickAdvanced, this));
mSettingsPanel->getChild<LLButton>("defaults_btn")->setCommitCallback(boost::bind(&LLFloaterPerformance::onClickDefaults, this));
@@ -527,9 +527,13 @@ void LLFloaterPerformance::setFPSText()
mTextFPSLabel->setValue(fps_text);
}
-void LLFloaterPerformance::detachItem(const LLUUID& item_id)
+void LLFloaterPerformance::detachObject(const LLUUID& obj_id)
{
- LLAppearanceMgr::instance().removeItemFromAvatar(item_id);
+ LLViewerObject* obj = gObjectList.findObject(obj_id);
+ if (obj)
+ {
+ LLAppearanceMgr::instance().removeItemFromAvatar(obj->getAttachmentItemID());
+ }
}
void LLFloaterPerformance::onClickAdvanced()
diff --git a/indra/newview/llfloaterperformance.h b/indra/newview/llfloaterperformance.h
index a7100eb350..6cca85a009 100644
--- a/indra/newview/llfloaterperformance.h
+++ b/indra/newview/llfloaterperformance.h
@@ -48,7 +48,7 @@ public:
void hidePanels();
void showAutoadjustmentsPanel();
- void detachItem(const LLUUID& item_id);
+ void detachObject(const LLUUID& obj_id);
void onAvatarListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index a8596c1b9f..d60d41ae3c 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -329,6 +329,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mCommitCallbackRegistrar.add("Pref.AutoAdjustments", { boost::bind(&LLFloaterPreference::onClickAutoAdjustments, this), cb_info::UNTRUSTED_BLOCK });
mCommitCallbackRegistrar.add("Pref.HardwareDefaults", { boost::bind(&LLFloaterPreference::setHardwareDefaults, this), cb_info::UNTRUSTED_BLOCK });
mCommitCallbackRegistrar.add("Pref.AvatarImpostorsEnable", { boost::bind(&LLFloaterPreference::onAvatarImpostorsEnable, this), cb_info::UNTRUSTED_BLOCK });
+ mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxNonImpostors", { boost::bind(&LLFloaterPreference::updateMaxNonImpostors, this), cb_info::UNTRUSTED_BLOCK });
mCommitCallbackRegistrar.add("Pref.UpdateIndirectMaxComplexity", { boost::bind(&LLFloaterPreference::updateMaxComplexity, this), cb_info::UNTRUSTED_BLOCK });
mCommitCallbackRegistrar.add("Pref.RenderOptionUpdate", { boost::bind(&LLFloaterPreference::onRenderOptionEnable, this), cb_info::UNTRUSTED_BLOCK });
mCommitCallbackRegistrar.add("Pref.WindowedMod", { boost::bind(&LLFloaterPreference::onCommitWindowedMode, this), cb_info::UNTRUSTED_BLOCK });
@@ -360,6 +361,7 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
LLAvatarPropertiesProcessor::getInstance()->addObserver( gAgent.getID(), this );
mComplexityChangedSignal = gSavedSettings.getControl("RenderAvatarMaxComplexity")->getCommitSignal()->connect(boost::bind(&LLFloaterPreference::updateComplexityText, this));
+ mImpostorsChangedSignal = gSavedSettings.getControl("RenderAvatarMaxNonImpostors")->getSignal()->connect(boost::bind(&LLFloaterPreference::updateIndirectMaxNonImpostors, this, _2));
mCommitCallbackRegistrar.add("Pref.ClearLog", { boost::bind(&LLConversationLog::onClearLog, &LLConversationLog::instance()), cb_info::UNTRUSTED_BLOCK });
mCommitCallbackRegistrar.add("Pref.DeleteTranscripts", { boost::bind(&LLFloaterPreference::onDeleteTranscripts, this), cb_info::UNTRUSTED_BLOCK });
@@ -543,6 +545,7 @@ LLFloaterPreference::~LLFloaterPreference()
{
LLConversationLog::instance().removeObserver(this);
mComplexityChangedSignal.disconnect();
+ mImpostorsChangedSignal.disconnect();
}
void LLFloaterPreference::draw()
@@ -1287,6 +1290,9 @@ void LLAvatarComplexityControls::setIndirectMaxArc()
void LLFloaterPreference::refresh()
{
LLPanel::refresh();
+ setMaxNonImpostorsText(
+ gSavedSettings.getU32("RenderAvatarMaxNonImpostors"),
+ getChild<LLTextBox>("IndirectMaxNonImpostorsText", true));
LLAvatarComplexityControls::setText(
gSavedSettings.getU32("RenderAvatarMaxComplexity"),
getChild<LLTextBox>("IndirectMaxComplexityText", true));
@@ -1561,6 +1567,44 @@ void LLAvatarComplexityControls::setRenderTimeText(F32 value, LLTextBox* text_bo
}
}
+void LLFloaterPreference::updateMaxNonImpostors()
+{
+ // Called when the IndirectMaxNonImpostors control changes
+ // Responsible for fixing the slider label (IndirectMaxNonImpostorsText) and setting RenderAvatarMaxNonImpostors
+ LLSliderCtrl* ctrl = getChild<LLSliderCtrl>("IndirectMaxNonImpostors", true);
+ U32 value = ctrl->getValue().asInteger();
+
+ if (0 == value || LLVOAvatar::NON_IMPOSTORS_MAX_SLIDER <= value)
+ {
+ value = 0;
+ }
+ gSavedSettings.setU32("RenderAvatarMaxNonImpostors", value);
+ LLVOAvatar::updateImpostorRendering(value); // make it effective immediately
+ setMaxNonImpostorsText(value, getChild<LLTextBox>("IndirectMaxNonImpostorsText"));
+}
+
+void LLFloaterPreference::updateIndirectMaxNonImpostors(const LLSD& newvalue)
+{
+ U32 value = newvalue.asInteger();
+ if ((value != 0) && (value != gSavedSettings.getU32("IndirectMaxNonImpostors")))
+ {
+ gSavedSettings.setU32("IndirectMaxNonImpostors", value);
+ }
+ setMaxNonImpostorsText(value, getChild<LLTextBox>("IndirectMaxNonImpostorsText"));
+}
+
+void LLFloaterPreference::setMaxNonImpostorsText(U32 value, LLTextBox* text_box)
+{
+ if (0 == value)
+ {
+ text_box->setText(LLTrans::getString("no_limit"));
+ }
+ else
+ {
+ text_box->setText(llformat("%d", value));
+ }
+}
+
void LLFloaterPreference::updateMaxComplexity()
{
// Called when the IndirectMaxComplexity control changes
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 51ed3d8179..40806c22fc 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -206,6 +206,9 @@ private:
void onDeleteTranscripts();
void onDeleteTranscriptsResponse(const LLSD& notification, const LLSD& response);
void updateDeleteTranscriptsButton();
+ void updateMaxNonImpostors();
+ void updateIndirectMaxNonImpostors(const LLSD& newvalue);
+ void setMaxNonImpostorsText(U32 value, LLTextBox* text_box);
void updateMaxComplexity();
void updateComplexityText();
static bool loadFromFilename(const std::string& filename, std::map<std::string, std::string> &label_map);
@@ -234,6 +237,7 @@ private:
std::unique_ptr< ll::prefs::SearchData > mSearchData;
bool mSearchDataDirty;
+ boost::signals2::connection mImpostorsChangedSignal;
boost::signals2::connection mComplexityChangedSignal;
void onUpdateFilterTerm( bool force = false );
diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp
index cf2123cfac..3cccecfa4a 100644
--- a/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp
+++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.cpp
@@ -247,8 +247,8 @@ void LLFloaterPreferenceGraphicsAdvanced::updateIndirectMaxNonImpostors(const LL
if ((value != 0) && (value != gSavedSettings.getU32("IndirectMaxNonImpostors")))
{
gSavedSettings.setU32("IndirectMaxNonImpostors", value);
- setMaxNonImpostorsText(value, getChild<LLTextBox>("IndirectMaxNonImpostorsText"));
}
+ setMaxNonImpostorsText(value, getChild<LLTextBox>("IndirectMaxNonImpostorsText"));
}
void LLFloaterPreferenceGraphicsAdvanced::setMaxNonImpostorsText(U32 value, LLTextBox* text_box)
diff --git a/indra/newview/llfloaterpreferencesgraphicsadvanced.h b/indra/newview/llfloaterpreferencesgraphicsadvanced.h
index 61203be068..6f793c1379 100644
--- a/indra/newview/llfloaterpreferencesgraphicsadvanced.h
+++ b/indra/newview/llfloaterpreferencesgraphicsadvanced.h
@@ -61,6 +61,7 @@ protected:
void onBtnOK(const LLSD& userdata);
void onBtnCancel(const LLSD& userdata);
+ boost::signals2::connection mImpostorsChangedSignal;
boost::signals2::connection mComplexityChangedSignal;
boost::signals2::connection mComplexityModeChangedSignal;
boost::signals2::connection mLODFactorChangedSignal;
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 99ab75f713..165fb5ef88 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -2820,6 +2820,16 @@ void LLPanelEstateCovenant::setEstateName(const std::string& name)
}
// static
+void LLPanelEstateCovenant::updateCovenant(const LLTextBase* source, const LLUUID& asset_id)
+{
+ if (LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant())
+ {
+ panelp->mEditor->copyContents(source);
+ panelp->setCovenantID(asset_id);
+ }
+}
+
+// static
void LLPanelEstateCovenant::updateCovenantText(const std::string& string, const LLUUID& asset_id)
{
LLPanelEstateCovenant* panelp = LLFloaterRegionInfo::getPanelCovenant();
@@ -4330,7 +4340,6 @@ void LLPanelRegionEnvironment::onChkAllowOverride(bool value)
mAllowOverrideRestore = mAllowOverride;
mAllowOverride = value;
-
std::string notification("EstateParcelEnvironmentOverride");
if (LLPanelEstateInfo::isLindenEstate())
notification = "ChangeLindenEstate";
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index b604a28fc3..65c1291728 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -382,6 +382,7 @@ public:
void* user_data, S32 status, LLExtStat ext_status);
// Accessor functions
+ static void updateCovenant(const LLTextBase* source, const LLUUID& asset_id);
static void updateCovenantText(const std::string& string, const LLUUID& asset_id);
static void updateEstateName(const std::string& name);
static void updateLastModified(const std::string& text);
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 1f52f1d180..fb4537f22a 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -1297,7 +1297,8 @@ bool LLFloaterSnapshotBase::ImplBase::updatePreviewList(bool initialized)
void LLFloaterSnapshotBase::ImplBase::updateLivePreview()
{
- if (ImplBase::updatePreviewList(true) && mFloater)
+ // don't update preview for hidden floater
+ if (mFloater && mFloater->isInVisibleChain() && ImplBase::updatePreviewList(true))
{
LL_DEBUGS() << "changed" << LL_ENDL;
updateControls(mFloater);
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index fc02220808..112008172e 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -68,7 +68,7 @@
#include <vector>
// Height of the yellow selection highlight posts for land
-const F32 PARCEL_POST_HEIGHT = 0.666f;
+constexpr F32 PARCEL_POST_HEIGHT = 0.666f;
// Returns true if you got at least one object
void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
@@ -178,27 +178,27 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
{
std::vector<LLDrawable*> potentials;
- for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
- iter != LLWorld::getInstance()->getRegionList().end(); ++iter)
+ for (LLViewerRegion* region : LLWorld::getInstance()->getRegionList())
{
- LLViewerRegion* region = *iter;
for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++)
{
- LLSpatialPartition* part = region->getSpatialPartition(i);
- if (part)
+ if (LLSpatialPartition* part = region->getSpatialPartition(i))
{
part->cull(*LLViewerCamera::getInstance(), &potentials, true);
}
}
}
- for (std::vector<LLDrawable*>::iterator iter = potentials.begin();
- iter != potentials.end(); iter++)
+ for (LLDrawable* drawable : potentials)
{
- LLDrawable* drawable = *iter;
+ if (!drawable)
+ {
+ continue;
+ }
+
LLViewerObject* vobjp = drawable->getVObj();
- if (!drawable || !vobjp ||
+ if (!vobjp ||
vobjp->getPCode() != LL_PCODE_VOLUME ||
vobjp->isAttachment() ||
(deselect && !vobjp->isSelected()))
@@ -244,7 +244,7 @@ void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask)
gViewerWindow->setup3DRender();
}
-const F32 WIND_RELATIVE_ALTITUDE = 25.f;
+constexpr F32 WIND_RELATIVE_ALTITUDE = 25.f;
void LLWind::renderVectors()
{
@@ -266,14 +266,14 @@ void LLWind::renderVectors()
x = mVelX[i + j*mSize] * WIND_SCALE_HACK;
y = mVelY[i + j*mSize] * WIND_SCALE_HACK;
gGL.pushMatrix();
- gGL.translatef((F32)i * region_width_meters/mSize, (F32)j * region_width_meters/mSize, 0.0);
- gGL.color3f(0,1,0);
+ gGL.translatef((F32)i * region_width_meters/mSize, (F32)j * region_width_meters/mSize, 0.f);
+ gGL.color3f(0.f, 1.f, 0.f);
gGL.begin(LLRender::POINTS);
- gGL.vertex3f(0,0,0);
+ gGL.vertex3f(0.f, 0.f, 0.f);
gGL.end();
- gGL.color3f(1,0,0);
+ gGL.color3f(1.f, 0.f, 0.f);
gGL.begin(LLRender::LINES);
- gGL.vertex3f(x * 0.1f, y * 0.1f ,0.f);
+ gGL.vertex3f(x * 0.1f, y * 0.1f, 0.f);
gGL.vertex3f(x, y, 0.f);
gGL.end();
gGL.popMatrix();
@@ -287,7 +287,7 @@ void LLWind::renderVectors()
// Used by lltoolselectland
void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global,
- const LLVector3d &east_north_top_global )
+ const LLVector3d &east_north_top_global)
{
LLGLSUIDefault gls_ui;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -338,118 +338,23 @@ void LLViewerParcelMgr::renderRect(const LLVector3d &west_south_bottom_global,
gGL.end();
gGL.color4f(1.f, 1.f, 0.f, 0.2f);
- gGL.begin(LLRender::QUADS);
-
- gGL.vertex3f(west, north, nw_bottom);
- gGL.vertex3f(west, north, nw_top);
- gGL.vertex3f(east, north, ne_top);
- gGL.vertex3f(east, north, ne_bottom);
-
- gGL.vertex3f(east, north, ne_bottom);
- gGL.vertex3f(east, north, ne_top);
- gGL.vertex3f(east, south, se_top);
- gGL.vertex3f(east, south, se_bottom);
-
- gGL.vertex3f(east, south, se_bottom);
- gGL.vertex3f(east, south, se_top);
- gGL.vertex3f(west, south, sw_top);
- gGL.vertex3f(west, south, sw_bottom);
-
- gGL.vertex3f(west, south, sw_bottom);
- gGL.vertex3f(west, south, sw_top);
- gGL.vertex3f(west, north, nw_top);
- gGL.vertex3f(west, north, nw_bottom);
-
- gGL.end();
-
- LLUI::setLineWidth(1.f);
-}
-
-/*
-void LLViewerParcelMgr::renderParcel(LLParcel* parcel )
-{
- S32 i;
- S32 count = parcel->getBoxCount();
- for (i = 0; i < count; i++)
+ gGL.begin(LLRender::TRIANGLE_STRIP);
{
- const LLParcelBox& box = parcel->getBox(i);
-
- F32 west = box.mMin.mV[VX];
- F32 south = box.mMin.mV[VY];
-
- F32 east = box.mMax.mV[VX];
- F32 north = box.mMax.mV[VY];
-
- // HACK: At edge of last region of world, we need to make sure the region
- // resolves correctly so we can get a height value.
- const F32 FUDGE = 0.01f;
-
- F32 sw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, south, 0.f ) );
- F32 se_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, south, 0.f ) );
- F32 ne_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( east-FUDGE, north-FUDGE, 0.f ) );
- F32 nw_bottom = LLWorld::getInstance()->resolveLandHeightAgent( LLVector3( west, north-FUDGE, 0.f ) );
-
- // little hack to make nearby lines not Z-fight
- east -= 0.1f;
- north -= 0.1f;
-
- F32 sw_top = sw_bottom + POST_HEIGHT;
- F32 se_top = se_bottom + POST_HEIGHT;
- F32 ne_top = ne_bottom + POST_HEIGHT;
- F32 nw_top = nw_bottom + POST_HEIGHT;
-
- gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- LLGLDepthTest gls_depth(GL_TRUE);
-
- LLUI::setLineWidth(2.f);
- gGL.color4f(0.f, 1.f, 1.f, 1.f);
-
- // Cheat and give this the same pick-name as land
- gGL.begin(LLRender::LINES);
-
- gGL.vertex3f(west, north, nw_bottom);
- gGL.vertex3f(west, north, nw_top);
-
- gGL.vertex3f(east, north, ne_bottom);
- gGL.vertex3f(east, north, ne_top);
-
- gGL.vertex3f(east, south, se_bottom);
- gGL.vertex3f(east, south, se_top);
-
- gGL.vertex3f(west, south, sw_bottom);
- gGL.vertex3f(west, south, sw_top);
-
- gGL.end();
-
- gGL.color4f(0.f, 1.f, 1.f, 0.2f);
- gGL.begin(LLRender::QUADS);
-
gGL.vertex3f(west, north, nw_bottom);
gGL.vertex3f(west, north, nw_top);
- gGL.vertex3f(east, north, ne_top);
- gGL.vertex3f(east, north, ne_bottom);
-
gGL.vertex3f(east, north, ne_bottom);
gGL.vertex3f(east, north, ne_top);
- gGL.vertex3f(east, south, se_top);
- gGL.vertex3f(east, south, se_bottom);
-
gGL.vertex3f(east, south, se_bottom);
gGL.vertex3f(east, south, se_top);
gGL.vertex3f(west, south, sw_top);
gGL.vertex3f(west, south, sw_bottom);
-
- gGL.vertex3f(west, south, sw_bottom);
- gGL.vertex3f(west, south, sw_top);
gGL.vertex3f(west, north, nw_top);
gGL.vertex3f(west, north, nw_bottom);
-
- gGL.end();
-
- LLUI::setLineWidth(1.f);
}
+ gGL.end();
+
+ LLUI::setLineWidth(1.f);
}
-*/
// north = a wall going north/south. Need that info to set up texture
@@ -493,6 +398,10 @@ void LLViewerParcelMgr::renderOneSegment(F32 x1, F32 y1, F32 x2, F32 y2, F32 hei
gGL.vertex3f(x2, y2, z2);
+ gGL.vertex3f(x1, y1, z);
+
+ gGL.vertex3f(x2, y2, z2);
+
z = z2+height;
gGL.vertex3f(x2, y2, z);
}
@@ -523,18 +432,24 @@ void LLViewerParcelMgr::renderOneSegment(F32 x1, F32 y1, F32 x2, F32 y2, F32 hei
}
- gGL.texCoord2f(tex_coord1*0.5f+0.5f, z1*0.5f);
+ gGL.texCoord2f(tex_coord1 * 0.5f + 0.5f, z1 * 0.5f);
gGL.vertex3f(x1, y1, z1);
- gGL.texCoord2f(tex_coord2*0.5f+0.5f, z2*0.5f);
+ gGL.texCoord2f(tex_coord2 * 0.5f + 0.5f, z2 * 0.5f);
gGL.vertex3f(x2, y2, z2);
// top edge stairsteps
- z = llmax(z2+height, z1+height);
- gGL.texCoord2f(tex_coord2*0.5f+0.5f, z*0.5f);
+ z = llmax(z2 + height, z1 + height);
+ gGL.texCoord2f(tex_coord2 * 0.5f + 0.5f, z * 0.5f);
+ gGL.vertex3f(x2, y2, z);
+
+ gGL.texCoord2f(tex_coord1 * 0.5f + 0.5f, z1 * 0.5f);
+ gGL.vertex3f(x1, y1, z1);
+
+ gGL.texCoord2f(tex_coord2 * 0.5f + 0.5f, z * 0.5f);
gGL.vertex3f(x2, y2, z);
- gGL.texCoord2f(tex_coord1*0.5f+0.5f, z*0.5f);
+ gGL.texCoord2f(tex_coord1 * 0.5f + 0.5f, z * 0.5f);
gGL.vertex3f(x1, y1, z);
}
}
@@ -575,7 +490,7 @@ void LLViewerParcelMgr::renderHighlightSegments(const U8* segments, LLViewerRegi
if (!has_segments)
{
has_segments = true;
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
}
renderOneSegment(x1, y1, x2, y2, PARCEL_POST_HEIGHT, SOUTH_MASK, regionp);
}
@@ -591,7 +506,7 @@ void LLViewerParcelMgr::renderHighlightSegments(const U8* segments, LLViewerRegi
if (!has_segments)
{
has_segments = true;
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
}
renderOneSegment(x1, y1, x2, y2, PARCEL_POST_HEIGHT, WEST_MASK, regionp);
}
@@ -647,7 +562,7 @@ void LLViewerParcelMgr::renderCollisionSegments(U8* segments, bool use_pass, LLV
gGL.getTexUnit(0)->bind(mBlockedImage);
}
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
for (y = 0; y < STRIDE; y++)
{
diff --git a/indra/newview/llgltfmaterialpreviewmgr.cpp b/indra/newview/llgltfmaterialpreviewmgr.cpp
index 294b445694..cf6b08797d 100644
--- a/indra/newview/llgltfmaterialpreviewmgr.cpp
+++ b/indra/newview/llgltfmaterialpreviewmgr.cpp
@@ -193,7 +193,7 @@ LLGLTFPreviewTexture::LLGLTFPreviewTexture(LLPointer<LLFetchedGLTFMaterial> mate
// static
LLPointer<LLGLTFPreviewTexture> LLGLTFPreviewTexture::create(LLPointer<LLFetchedGLTFMaterial> material)
{
- return new LLGLTFPreviewTexture(material, LLPipeline::MAX_BAKE_WIDTH);
+ return new LLGLTFPreviewTexture(material, LLPipeline::MAX_PREVIEW_WIDTH);
}
bool LLGLTFPreviewTexture::needsRender()
diff --git a/indra/newview/llhttpretrypolicy.cpp b/indra/newview/llhttpretrypolicy.cpp
index 3e55030610..c5692554c6 100644
--- a/indra/newview/llhttpretrypolicy.cpp
+++ b/indra/newview/llhttpretrypolicy.cpp
@@ -91,14 +91,14 @@ void LLAdaptiveRetryPolicy::onSuccess()
void LLAdaptiveRetryPolicy::onFailure(S32 status, const LLSD& headers)
{
- F32 retry_header_time;
+ F32 retry_header_time{};
bool has_retry_header_time = getRetryAfter(headers,retry_header_time);
onFailureCommon(status, has_retry_header_time, retry_header_time);
}
void LLAdaptiveRetryPolicy::onFailure(const LLCore::HttpResponse *response)
{
- F32 retry_header_time;
+ F32 retry_header_time{};
const LLCore::HttpHeaders::ptr_t headers = response->getHeaders();
bool has_retry_header_time = getRetryAfter(headers,retry_header_time);
onFailureCommon(response->getStatus().getType(), has_retry_header_time, retry_header_time);
@@ -184,4 +184,3 @@ bool LLAdaptiveRetryPolicy::getSecondsUntilRetryAfter(const std::string& retry_a
return true;
}
-
diff --git a/indra/newview/llhudeffectblob.cpp b/indra/newview/llhudeffectblob.cpp
index b476226d05..bdb21fd96e 100644
--- a/indra/newview/llhudeffectblob.cpp
+++ b/indra/newview/llhudeffectblob.cpp
@@ -78,16 +78,23 @@ void LLHUDEffectBlob::render()
LLVector3 u_scale = pixel_right * (F32)mPixelSize;
LLVector3 v_scale = pixel_up * (F32)mPixelSize;
- { gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
+ {
gGL.texCoord2f(0.f, 1.f);
gGL.vertex3fv((v_scale - u_scale).mV);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex3fv((-v_scale - u_scale).mV);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex3fv((-v_scale + u_scale).mV);
+
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3fv((v_scale - u_scale).mV);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3fv((-v_scale + u_scale).mV);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex3fv((v_scale + u_scale).mV);
- } gGL.end();
+ }
+ gGL.end();
} gGL.popMatrix();
}
diff --git a/indra/newview/llhudicon.cpp b/indra/newview/llhudicon.cpp
index 8fa4118a40..1a4af470bd 100644
--- a/indra/newview/llhudicon.cpp
+++ b/indra/newview/llhudicon.cpp
@@ -152,7 +152,7 @@ void LLHUDIcon::render()
gGL.getTexUnit(0)->bind(mImagep);
}
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.texCoord2f(0.f, 1.f);
gGL.vertex3fv(upper_left.mV);
@@ -160,6 +160,11 @@ void LLHUDIcon::render()
gGL.vertex3fv(lower_left.mV);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex3fv(lower_right.mV);
+
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3fv(upper_left.mV);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3fv(lower_right.mV);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex3fv(upper_right.mV);
}
diff --git a/indra/newview/llhudnametag.cpp b/indra/newview/llhudnametag.cpp
index 19ae35813c..66130a2744 100644
--- a/indra/newview/llhudnametag.cpp
+++ b/indra/newview/llhudnametag.cpp
@@ -275,7 +275,8 @@ void LLHUDNameTag::renderText()
LLVector3 x_pixel_vec;
LLVector3 y_pixel_vec;
- LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ camera->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
LLVector3 width_vec = mWidth * x_pixel_vec;
LLVector3 height_vec = mHeight * y_pixel_vec;
@@ -283,7 +284,7 @@ void LLHUDNameTag::renderText()
mRadius = (width_vec + height_vec).magVec() * 0.5f;
LLCoordGL screen_pos;
- LLViewerCamera::getInstance()->projectPosAgentToScreen(mPositionAgent, screen_pos, false);
+ camera->projectPosAgentToScreen(mPositionAgent, screen_pos, false);
LLVector2 screen_offset = updateScreenPos(mPositionOffset);
@@ -310,7 +311,7 @@ void LLHUDNameTag::renderText()
const S32 label_height = ll_round((mFontp->getLineHeight() * (F32)mLabelSegments.size() + (VERTICAL_PADDING / 3.f)));
label_top_rect.mBottom = label_top_rect.mTop - label_height;
LLColor4 label_top_color = text_color;
- label_top_color.mV[VALPHA] = gSavedSettings.getF32("ChatBubbleOpacity") * alpha_factor;
+ label_top_color.mV[VALPHA] = bubble_opacity() * alpha_factor;
mRoundedRectTopImgp->draw3D(render_position, x_pixel_vec, y_pixel_vec, label_top_rect, label_top_color);
}
@@ -645,12 +646,13 @@ LLVector2 LLHUDNameTag::updateScreenPos(LLVector2 &offset)
LLVector2 screen_pos_vec;
LLVector3 x_pixel_vec;
LLVector3 y_pixel_vec;
- LLViewerCamera::getInstance()->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+ camera->getPixelVectors(mPositionAgent, y_pixel_vec, x_pixel_vec);
LLVector3 world_pos = mPositionAgent + (offset.mV[VX] * x_pixel_vec) + (offset.mV[VY] * y_pixel_vec);
- if (!LLViewerCamera::getInstance()->projectPosAgentToScreen(world_pos, screen_pos, false) && mVisibleOffScreen)
+ if (!camera->projectPosAgentToScreen(world_pos, screen_pos, false) && mVisibleOffScreen)
{
// bubble off-screen, so find a spot for it along screen edge
- LLViewerCamera::getInstance()->projectPosAgentToScreenEdge(world_pos, screen_pos);
+ camera->projectPosAgentToScreenEdge(world_pos, screen_pos);
}
screen_pos_vec.setVec((F32)screen_pos.mX, (F32)screen_pos.mY);
diff --git a/indra/newview/llhudrender.cpp b/indra/newview/llhudrender.cpp
index 4180e49e94..aa440c6cf5 100644
--- a/indra/newview/llhudrender.cpp
+++ b/indra/newview/llhudrender.cpp
@@ -63,6 +63,7 @@ void hud_render_text(const LLWString &wstr, const LLVector3 &pos_agent,
const LLColor4& color,
const bool orthographic)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_UI;
LLViewerCamera* camera = LLViewerCamera::getInstance();
// Do cheap plane culling
LLVector3 dir_vec = pos_agent - camera->getOrigin();
diff --git a/indra/newview/llimprocessing.cpp b/indra/newview/llimprocessing.cpp
index c1e68e0288..590cd09a31 100644
--- a/indra/newview/llimprocessing.cpp
+++ b/indra/newview/llimprocessing.cpp
@@ -488,7 +488,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
case IM_NOTHING_SPECIAL: // p2p IM
// Don't show dialog, just do IM
if (!gAgent.isGodlike()
- && gAgent.getRegion()->isPrelude()
+ && gAgent.inPrelude()
&& to_id.isNull())
{
// do nothing -- don't distract newbies in
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 06cf9919b6..1402cc8c37 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -3551,6 +3551,7 @@ void LLIMMgr::inviteToSession(
&& voice_invite && "VoiceInviteQuestionDefault" == question_type)
{
LL_INFOS("IMVIEW") << "Rejecting voice call from initiating muted resident " << caller_name << LL_ENDL;
+ payload["voice_channel_info"] = voice_channel_info;
LLIncomingCallDialog::processCallResponse(1, payload);
return;
}
@@ -3599,6 +3600,7 @@ void LLIMMgr::inviteToSession(
send_do_not_disturb_message(gMessageSystem, caller_id, session_id);
}
// silently decline the call
+ payload["voice_channel_info"] = voice_channel_info;
LLIncomingCallDialog::processCallResponse(1, payload);
return;
}
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 2e8b1b94fe..896c7d8d70 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -844,7 +844,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
disabled_items.push_back(std::string("Copy"));
}
- if (isAgentInventory() && !single_folder_root)
+ if (isAgentInventory() && !single_folder_root && !isMarketplaceListingsFolder())
{
items.push_back(std::string("New folder from selected"));
items.push_back(std::string("Subfolder Separator"));
@@ -5321,7 +5321,7 @@ void LLFolderBridge::dropToMyOutfits(LLInventoryCategory* inv_cat, LLPointer<LLI
// Note: creation will take time, so passing folder id to callback is slightly unreliable,
// but so is collecting and passing descendants' ids
- inventory_func_type func = boost::bind(&LLFolderBridge::outfitFolderCreatedCallback, this, inv_cat->getUUID(), _1, cb);
+ inventory_func_type func = boost::bind(outfitFolderCreatedCallback, inv_cat->getUUID(), _1, cb, mInventoryPanel);
gInventory.createNewCategory(dest_id,
LLFolderType::FT_OUTFIT,
inv_cat->getName(),
@@ -5329,11 +5329,25 @@ void LLFolderBridge::dropToMyOutfits(LLInventoryCategory* inv_cat, LLPointer<LLI
inv_cat->getThumbnailUUID());
}
-void LLFolderBridge::outfitFolderCreatedCallback(LLUUID cat_source_id, LLUUID cat_dest_id, LLPointer<LLInventoryCallback> cb)
+void LLFolderBridge::outfitFolderCreatedCallback(LLUUID cat_source_id,
+ LLUUID cat_dest_id,
+ LLPointer<LLInventoryCallback> cb,
+ LLHandle<LLInventoryPanel> inventory_panel)
{
LLInventoryModel::cat_array_t* categories;
LLInventoryModel::item_array_t* items;
- getInventoryModel()->getDirectDescendentsOf(cat_source_id, categories, items);
+
+ LLInventoryPanel* panel = inventory_panel.get();
+ if (!panel)
+ {
+ return;
+ }
+ LLInventoryModel* model = panel->getModel();
+ if (!model)
+ {
+ return;
+ }
+ model->getDirectDescendentsOf(cat_source_id, categories, items);
LLInventoryObject::const_object_list_t link_array;
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 746b79ce87..3e7f74384b 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -378,7 +378,10 @@ public:
static void staticFolderOptionsMenu();
protected:
- void outfitFolderCreatedCallback(LLUUID cat_source_id, LLUUID cat_dest_id, LLPointer<LLInventoryCallback> cb);
+ static void outfitFolderCreatedCallback(LLUUID cat_source_id,
+ LLUUID cat_dest_id,
+ LLPointer<LLInventoryCallback> cb,
+ LLHandle<LLInventoryPanel> inventory_panel);
void callback_pasteFromClipboard(const LLSD& notification, const LLSD& response);
void perform_pasteFromClipboard();
void gatherMessage(std::string& message, S32 depth, LLError::ELevel log_level);
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index 5c0905af3c..01f2c6c525 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -959,7 +959,7 @@ void LLInventoryFilter::setFilterSubString(const std::string& string)
boost::char_separator<char> sep("+");
tokenizer tokens(filter_sub_string_new, sep);
- for (auto token_iter : tokens)
+ for (const auto& token_iter : tokens)
{
mFilterTokens.push_back(token_iter);
}
@@ -1025,7 +1025,7 @@ void LLInventoryFilter::setFilterSubString(const std::string& string)
}
// Cancel out UUID once the search string is modified
- if (mFilterOps.mFilterTypes == FILTERTYPE_UUID)
+ if (mFilterOps.mFilterTypes & FILTERTYPE_UUID)
{
mFilterOps.mFilterTypes &= ~FILTERTYPE_UUID;
mFilterOps.mFilterUUID = LLUUID::null;
@@ -1707,7 +1707,7 @@ std::string LLInventoryFilter::getEmptyLookupMessage(bool is_empty_folder) const
}
}
-bool LLInventoryFilter::areDateLimitsSet()
+bool LLInventoryFilter::areDateLimitsSet() const
{
return mFilterOps.mMinDate != time_min()
|| mFilterOps.mMaxDate != time_max()
diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h
index 7e64a03e73..612a161ba2 100644
--- a/indra/newview/llinventoryfilter.h
+++ b/indra/newview/llinventoryfilter.h
@@ -341,7 +341,7 @@ public:
bool checkAgainstFilterThumbnails(const LLUUID& object_id) const;
private:
- bool areDateLimitsSet();
+ bool areDateLimitsSet() const;
bool checkAgainstFilterSubString(const std::string& desc) const;
bool checkAgainstFilterType(const class LLFolderViewModelItemInventory* listener) const;
bool checkAgainstFilterType(const LLInventoryItem* item) const;
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 70a0d078fe..2449a226c3 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -2045,8 +2045,8 @@ void LLInventoryModel::deleteObject(const LLUUID& id, bool fix_broken_links, boo
{
LL_WARNS(LOG_INV) << "Deleting cat " << id << " while it still has child cats" << LL_ENDL;
}
- delete cat_list;
mParentChildCategoryTree.erase(id);
+ delete cat_list;
}
addChangedMask(LLInventoryObserver::REMOVE, id);
@@ -5054,4 +5054,3 @@ void LLInventoryModel::FetchItemHttpHandler::processFailure(const char * const r
<< LLCoreHttpUtil::responseToString(response) << "]" << LL_ENDL;
gInventory.notifyObservers();
}
-
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index d8e6bf380e..2cf1554957 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -30,6 +30,7 @@
#include "llaisapi.h"
#include "llagent.h"
#include "llappviewer.h"
+#include "llappearancemgr.h"
#include "llcallbacklist.h"
#include "llinventorymodel.h"
#include "llinventorypanel.h"
@@ -470,6 +471,22 @@ void LLInventoryModelBackgroundFetch::fetchCOF(nullary_func_t callback)
callback();
LLUUID cat_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
LLInventoryModelBackgroundFetch::getInstance()->onAISFolderCalback(cat_id, id, FT_DEFAULT);
+
+ if (id.notNull())
+ {
+ // COF might have fetched base outfit folder through a link, but it hasn't
+ // fetched base outfit's content, which doesn't nessesary match COF,
+ // so make sure it's up to date
+ LLUUID baseoutfit_id = LLAppearanceMgr::getInstance()->getBaseOutfitUUID();
+ if (baseoutfit_id.notNull())
+ {
+ LLViewerInventoryCategory* cat = gInventory.getCategory(baseoutfit_id);
+ if (!cat || cat->getVersion() == LLViewerInventoryCategory::VERSION_UNKNOWN)
+ {
+ LLInventoryModelBackgroundFetch::getInstance()->fetchFolderAndLinks(baseoutfit_id, no_op);
+ }
+ }
+ }
});
// start idle loop to track completion
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index d08cd91382..b8833dcd05 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -580,8 +580,8 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve
if (model_item && view_item && viewmodel_item)
{
const LLUUID& idp = viewmodel_item->getUUID();
- view_item->destroyView();
removeItemID(idp);
+ view_item->destroyView();
}
LLInventoryObject const* objectp = mInventory->getObject(item_id);
diff --git a/indra/newview/lljoystickbutton.cpp b/indra/newview/lljoystickbutton.cpp
index 4eaf69c39d..10a1cd6b71 100644
--- a/indra/newview/lljoystickbutton.cpp
+++ b/indra/newview/lljoystickbutton.cpp
@@ -637,18 +637,24 @@ void LLJoystickCameraRotate::drawRotatedImage( LLPointer<LLUIImage> image, S32 r
gGL.color4fv(UI_VERTEX_COLOR.mV);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
- gGL.texCoord2fv( uv[ (rotations + 0) % 4]);
- gGL.vertex2i(width, height );
+ gGL.texCoord2fv(uv[(rotations + 0) % 4]);
+ gGL.vertex2i(width, height);
+
+ gGL.texCoord2fv(uv[(rotations + 1) % 4]);
+ gGL.vertex2i(0, height);
- gGL.texCoord2fv( uv[ (rotations + 1) % 4]);
- gGL.vertex2i(0, height );
+ gGL.texCoord2fv(uv[(rotations + 2) % 4]);
+ gGL.vertex2i(0, 0);
+
+ gGL.texCoord2fv(uv[(rotations + 0) % 4]);
+ gGL.vertex2i(width, height);
- gGL.texCoord2fv( uv[ (rotations + 2) % 4]);
+ gGL.texCoord2fv(uv[(rotations + 2) % 4]);
gGL.vertex2i(0, 0);
- gGL.texCoord2fv( uv[ (rotations + 3) % 4]);
+ gGL.texCoord2fv(uv[(rotations + 3) % 4]);
gGL.vertex2i(width, 0);
}
gGL.end();
@@ -909,7 +915,7 @@ void LLJoystickQuaternion::drawRotatedImage(LLPointer<LLUIImage> image, S32 rota
gGL.color4fv(UI_VERTEX_COLOR.mV);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.texCoord2fv(uv[(rotations + 0) % 4]);
gGL.vertex2i(width, height);
@@ -920,6 +926,12 @@ void LLJoystickQuaternion::drawRotatedImage(LLPointer<LLUIImage> image, S32 rota
gGL.texCoord2fv(uv[(rotations + 2) % 4]);
gGL.vertex2i(0, 0);
+ gGL.texCoord2fv(uv[(rotations + 0) % 4]);
+ gGL.vertex2i(width, height);
+
+ gGL.texCoord2fv(uv[(rotations + 1) % 4]);
+ gGL.vertex2i(0, height);
+
gGL.texCoord2fv(uv[(rotations + 3) % 4]);
gGL.vertex2i(width, 0);
}
diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp
index 9a0b1bfcd6..8bcfaa36e8 100644
--- a/indra/newview/llmanip.cpp
+++ b/indra/newview/llmanip.cpp
@@ -574,9 +574,6 @@ void LLManip::renderTickValue(const LLVector3& pos, F32 value, const std::string
gGL.scalef(inv_zoom_amt, inv_zoom_amt, inv_zoom_amt);
}
- LLColor4 shadow_color = LLColor4::black;
- shadow_color.mV[VALPHA] = color.mV[VALPHA] * 0.5f;
-
if (fractional_portion != 0)
{
fraction_string = llformat("%c%02d%s", LLResMgr::getInstance()->getDecimalPoint(), fractional_portion, suffix.c_str());
diff --git a/indra/newview/llmanipscale.cpp b/indra/newview/llmanipscale.cpp
index 19868f3c3e..9966a8eedb 100644
--- a/indra/newview/llmanipscale.cpp
+++ b/indra/newview/llmanipscale.cpp
@@ -618,43 +618,22 @@ void LLManipScale::renderFaces( const LLBBox& bbox )
{
gGL.color4fv( default_normal_color.mV );
LLGLDepthTest gls_depth(GL_FALSE);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLE_STRIP);
{
- // Face 0
- gGL.vertex3f(min.mV[VX], max.mV[VY], max.mV[VZ]);
- gGL.vertex3f(min.mV[VX], min.mV[VY], max.mV[VZ]);
- gGL.vertex3f(max.mV[VX], min.mV[VY], max.mV[VZ]);
- gGL.vertex3f(max.mV[VX], max.mV[VY], max.mV[VZ]);
-
- // Face 1
- gGL.vertex3f(max.mV[VX], min.mV[VY], max.mV[VZ]);
+ gGL.vertex3f(min.mV[VX], max.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], max.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(min.mV[VX], min.mV[VY], min.mV[VZ]);
gGL.vertex3f(max.mV[VX], min.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], min.mV[VY], max.mV[VZ]);
gGL.vertex3f(max.mV[VX], max.mV[VY], min.mV[VZ]);
gGL.vertex3f(max.mV[VX], max.mV[VY], max.mV[VZ]);
-
- // Face 2
gGL.vertex3f(min.mV[VX], max.mV[VY], min.mV[VZ]);
gGL.vertex3f(min.mV[VX], max.mV[VY], max.mV[VZ]);
- gGL.vertex3f(max.mV[VX], max.mV[VY], max.mV[VZ]);
- gGL.vertex3f(max.mV[VX], max.mV[VY], min.mV[VZ]);
-
- // Face 3
- gGL.vertex3f(min.mV[VX], max.mV[VY], max.mV[VZ]);
- gGL.vertex3f(min.mV[VX], max.mV[VY], min.mV[VZ]);
gGL.vertex3f(min.mV[VX], min.mV[VY], min.mV[VZ]);
gGL.vertex3f(min.mV[VX], min.mV[VY], max.mV[VZ]);
-
- // Face 4
- gGL.vertex3f(min.mV[VX], min.mV[VY], max.mV[VZ]);
- gGL.vertex3f(min.mV[VX], min.mV[VY], min.mV[VZ]);
- gGL.vertex3f(max.mV[VX], min.mV[VY], min.mV[VZ]);
gGL.vertex3f(max.mV[VX], min.mV[VY], max.mV[VZ]);
-
- // Face 5
- gGL.vertex3f(min.mV[VX], min.mV[VY], min.mV[VZ]);
- gGL.vertex3f(min.mV[VX], max.mV[VY], min.mV[VZ]);
- gGL.vertex3f(max.mV[VX], max.mV[VY], min.mV[VZ]);
- gGL.vertex3f(max.mV[VX], min.mV[VY], min.mV[VZ]);
+ gGL.vertex3f(min.mV[VX], max.mV[VY], max.mV[VZ]);
+ gGL.vertex3f(max.mV[VX], max.mV[VY], max.mV[VZ]);
}
gGL.end();
}
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index c635ab91c2..49260d5c50 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -843,7 +843,7 @@ void LLMediaCtrl::draw()
calcOffsetsAndSize(&x_offset, &y_offset, &width, &height);
// draw the browser
- gGL.begin( LLRender::QUADS );
+ gGL.begin(LLRender::TRIANGLES);
if (! media_plugin->getTextureCoordsOpenGL())
{
// render using web browser reported width and height, instead of trying to invert GL scale
@@ -856,6 +856,12 @@ void LLMediaCtrl::draw()
gGL.texCoord2f( 0.f, max_v );
gGL.vertex2i( x_offset, y_offset );
+ gGL.texCoord2f(max_u, 0.f);
+ gGL.vertex2i(x_offset + width, y_offset + height);
+
+ gGL.texCoord2f(0.f, max_v);
+ gGL.vertex2i(x_offset, y_offset);
+
gGL.texCoord2f( max_u, max_v );
gGL.vertex2i( x_offset + width, y_offset );
}
@@ -871,6 +877,12 @@ void LLMediaCtrl::draw()
gGL.texCoord2f( 0.f, 0.f );
gGL.vertex2i( x_offset, y_offset );
+ gGL.texCoord2f(max_u, max_v);
+ gGL.vertex2i(x_offset + width, y_offset + height);
+
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2i(x_offset, y_offset);
+
gGL.texCoord2f( max_u, 0.f );
gGL.vertex2i( x_offset + width, y_offset );
}
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 26e2d8f319..a8585c7f23 100644
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -77,6 +77,8 @@
#include "llinventorypanel.h"
#include "lluploaddialog.h"
#include "llfloaterreg.h"
+#include "llvoavatarself.h"
+#include "llskinningutil.h"
#include "boost/iostreams/device/array.hpp"
#include "boost/iostreams/stream.hpp"
@@ -757,7 +759,7 @@ void log_upload_error(LLCore::HttpStatus status, const LLSD& content,
<< " (" << status.toTerseString() << ")" << LL_ENDL;
std::ostringstream details;
- typedef std::set<std::string> mav_errors_set_t;
+ typedef std::unordered_set<std::string> mav_errors_set_t;
mav_errors_set_t mav_errors;
if (content.has("error"))
@@ -828,7 +830,8 @@ LLMeshRepoThread::LLMeshRepoThread()
mHttpLargeOptions(),
mHttpHeaders(),
mHttpPolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID),
- mHttpLargePolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID)
+ mHttpLargePolicyClass(LLCore::HttpRequest::DEFAULT_POLICY_ID),
+ mWorkQueue("MeshRepoThread", 1024*1024)
{
LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp());
@@ -911,6 +914,10 @@ void LLMeshRepoThread::run()
break;
}
+ // run mWorkQueue for up to 8ms
+ static std::chrono::nanoseconds WorkTimeNanoSec{std::chrono::nanoseconds::rep(8 * 1000000) };
+ mWorkQueue.runFor(WorkTimeNanoSec);
+
if (! mHttpRequestSet.empty())
{
// Dispatch all HttpHandler notifications
@@ -1322,7 +1329,7 @@ LLCore::HttpHandle LLMeshRepoThread::getByteRange(const std::string & url,
bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry)
{
-
+ LL_PROFILE_ZONE_SCOPED;
if (!mHeaderMutex)
{
return false;
@@ -1447,6 +1454,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id, bool can_retry)
bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)
{
+ LL_PROFILE_ZONE_SCOPED;
if (!mHeaderMutex)
{
return false;
@@ -1554,6 +1562,7 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id)
bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id)
{
+ LL_PROFILE_ZONE_SCOPED;
if (!mHeaderMutex)
{
return false;
@@ -1693,6 +1702,7 @@ void LLMeshRepoThread::decActiveHeaderRequests()
//return false if failed to get header
bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params, bool can_retry)
{
+ LL_PROFILE_ZONE_SCOPED;
++LLMeshRepository::sMeshRequestCount;
{
@@ -1756,6 +1766,7 @@ bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params, bool c
//return false if failed to get mesh lod.
bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, bool can_retry)
{
+ LL_PROFILE_ZONE_SCOPED;
if (!mHeaderMutex)
{
return false;
@@ -1940,6 +1951,18 @@ EMeshProcessingResult LLMeshRepoThread::headerReceived(const LLVolumeParams& mes
LLMeshRepository::sCacheBytesHeaders += (U32)header_size;
}
+ // immediately request SkinInfo since we'll need it before we can render any LoD if it is present
+ {
+ LLMutexLock lock(gMeshRepo.mMeshMutex);
+
+ if (gMeshRepo.mLoadingSkins.find(mesh_id) == gMeshRepo.mLoadingSkins.end())
+ {
+ gMeshRepo.mLoadingSkins[mesh_id] = {}; // add an empty vector to indicate to main thread that we are loading skin info
+ }
+ }
+
+ fetchMeshSkinInfo(mesh_id);
+
LLMutexLock lock(mMutex); // make sure only one thread access mPendingLOD at the same time.
//check for pending requests
@@ -1971,6 +1994,18 @@ EMeshProcessingResult LLMeshRepoThread::lodReceived(const LLVolumeParams& mesh_p
{
if (volume->getNumFaces() > 0)
{
+ // if we have a valid SkinInfo, cache per-joint bounding boxes for this LOD
+ LLMeshSkinInfo* skin_info = mSkinMap[mesh_params.getSculptID()];
+ if (skin_info && isAgentAvatarValid())
+ {
+ for (S32 i = 0; i < volume->getNumFaces(); ++i)
+ {
+ // NOTE: no need to lock gAgentAvatarp as the state being checked is not changed after initialization
+ LLVolumeFace& face = volume->getVolumeFace(i);
+ LLSkinningUtil::updateRiggingInfo(skin_info, gAgentAvatarp, face);
+ }
+ }
+
LoadedMesh mesh(volume, mesh_params, lod);
{
LLMutexLock lock(mMutex);
@@ -2014,18 +2049,19 @@ bool LLMeshRepoThread::skinInfoReceived(const LLUUID& mesh_id, U8* data, S32 dat
}
{
- LLMeshSkinInfo* info = nullptr;
- try
- {
- info = new LLMeshSkinInfo(mesh_id, skin);
- }
- catch (const std::bad_alloc& ex)
- {
- LL_WARNS() << "Failed to allocate skin info with exception: " << ex.what() << LL_ENDL;
- return false;
+ LLPointer<LLMeshSkinInfo> info = nullptr;
+ info = new LLMeshSkinInfo(mesh_id, skin);
+
+ if (isAgentAvatarValid())
+ { // joint numbers are consistent inside LLVOAvatar and animations, but inconsistent inside meshes,
+ // generate a map of mesh joint numbers to LLVOAvatar joint numbers
+ LLSkinningUtil::initJointNums(info, gAgentAvatarp);
}
- // LL_DEBUGS(LOG_MESH) << "info pelvis offset" << info.mPelvisOffset << LL_ENDL;
+ // remember the skin info in the background thread so we can use it
+ // to calculate per-joint bounding boxes when volumes are loaded
+ mSkinMap[mesh_id] = info;
+
{
LLMutexLock lock(mMutex);
mSkinInfoQ.push_back(info);
@@ -2265,10 +2301,10 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures)
S32 mesh_num = 0;
S32 texture_num = 0;
- std::set<LLViewerTexture* > textures;
- std::map<LLViewerTexture*,S32> texture_index;
+ std::unordered_set<LLViewerTexture* > textures;
+ std::unordered_map<LLViewerTexture*,S32> texture_index;
- std::map<LLModel*,S32> mesh_index;
+ std::unordered_map<LLModel*,S32> mesh_index;
std::string model_name;
S32 instance_num = 0;
@@ -2957,7 +2993,7 @@ void LLMeshRepoThread::notifyLoadedMeshes()
{
if (mMutex->trylock())
{
- std::deque<LLMeshSkinInfo*> skin_info_q;
+ std::deque<LLPointer<LLMeshSkinInfo>> skin_info_q;
std::deque<UUIDBasedRequest> skin_info_unavail_q;
std::list<LLModel::Decomposition*> decomp_q;
@@ -3080,6 +3116,7 @@ S32 LLMeshRepository::getActualMeshLOD(LLMeshHeader& header, S32 lod)
// are cases far off the norm.
void LLMeshHandlerBase::onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response)
{
+ LL_PROFILE_ZONE_SCOPED;
mProcessed = true;
unsigned int retries(0U);
@@ -3356,6 +3393,7 @@ void LLMeshLODHandler::processFailure(LLCore::HttpStatus status)
void LLMeshLODHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
U8 * data, S32 data_size)
{
+ LL_PROFILE_ZONE_SCOPED;
if ((!MESH_LOD_PROCESS_FAILED)
&& ((data != NULL) == (data_size > 0))) // if we have data but no size or have size but no data, something is wrong
{
@@ -3421,6 +3459,7 @@ void LLMeshSkinInfoHandler::processFailure(LLCore::HttpStatus status)
void LLMeshSkinInfoHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
U8 * data, S32 data_size)
{
+ LL_PROFILE_ZONE_SCOPED;
if ((!MESH_SKIN_INFO_PROCESS_FAILED)
&& ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
&& gMeshRepo.mThread->skinInfoReceived(mMeshID, data, data_size))
@@ -3470,6 +3509,7 @@ void LLMeshDecompositionHandler::processFailure(LLCore::HttpStatus status)
void LLMeshDecompositionHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
U8 * data, S32 data_size)
{
+ LL_PROFILE_ZONE_SCOPED;
if ((!MESH_DECOMP_PROCESS_FAILED)
&& ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
&& gMeshRepo.mThread->decompositionReceived(mMeshID, data, data_size))
@@ -3517,6 +3557,7 @@ void LLMeshPhysicsShapeHandler::processFailure(LLCore::HttpStatus status)
void LLMeshPhysicsShapeHandler::processData(LLCore::BufferArray * /* body */, S32 /* body_offset */,
U8 * data, S32 data_size)
{
+ LL_PROFILE_ZONE_SCOPED;
if ((!MESH_PHYS_SHAPE_PROCESS_FAILED)
&& ((data != NULL) == (data_size > 0)) // if we have data but no size or have size but no data, something is wrong
&& gMeshRepo.mThread->physicsShapeReceived(mMeshID, data, data_size) == MESH_OK)
@@ -3651,20 +3692,63 @@ S32 LLMeshRepository::update()
return static_cast<S32>(size);
}
-void LLMeshRepository::unregisterMesh(LLVOVolume* vobj)
+void LLMeshRepository::unregisterMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_params, S32 detail)
{
- for (auto& lod : mLoadingMeshes)
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
+
+ llassert((mesh_params.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH);
+ llassert(mesh_params.getSculptID().notNull());
+ auto& lod = mLoadingMeshes[detail];
+ auto param_iter = lod.find(mesh_params.getSculptID());
+ if (param_iter != lod.end())
+ {
+ vector_replace_with_last(param_iter->second, vobj);
+ llassert(!vector_replace_with_last(param_iter->second, vobj));
+ if (param_iter->second.empty())
+ {
+ lod.erase(param_iter);
+ }
+ }
+}
+
+void LLMeshRepository::unregisterSkinInfo(const LLUUID& mesh_id, LLVOVolume* vobj)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
+
+ llassert(mesh_id.notNull());
+ auto skin_pair_iter = mLoadingSkins.find(mesh_id);
+ if (skin_pair_iter != mLoadingSkins.end())
{
- for (auto& param : lod)
+ vector_replace_with_last(skin_pair_iter->second, vobj);
+ llassert(!vector_replace_with_last(skin_pair_iter->second, vobj));
+ if (skin_pair_iter->second.empty())
{
- vector_replace_with_last(param.second, vobj);
+ mLoadingSkins.erase(skin_pair_iter);
}
}
+}
+
+// Lots of dead objects make expensive calls to
+// LLMeshRepository::unregisterMesh which may delay shutdown. Avoid this by
+// preemptively unregistering all meshes.
+// We can also do this safely if all objects are confirmed dead for some other
+// reason.
+void LLMeshRepository::unregisterAllMeshes()
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
- for (auto& skin_pair : mLoadingSkins)
+ // The size of mLoadingMeshes and mLoadingSkins may be large and thus
+ // expensive to iterate over in LLVOVolume::~LLVOVolume.
+ // This is unnecessary during shutdown, so we ignore the referenced objects in the
+ // least expensive way which is still safe: by clearing these containers.
+ // Clear now and not in LLMeshRepository::shutdown because
+ // LLMeshRepository::notifyLoadedMeshes could (depending on invocation
+ // order) reference a pointer to an object after it has been deleted.
+ for (auto& lod : mLoadingMeshes)
{
- vector_replace_with_last(skin_pair.second, vobj);
+ lod.clear();
}
+ mLoadingSkins.clear();
}
S32 LLMeshRepository::loadMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_params, S32 detail, S32 last_lod)
@@ -3859,6 +3943,7 @@ void LLMeshRepository::notifyLoadedMeshes()
for (auto iter = mSkinMap.begin(), ender = mSkinMap.end(); iter != ender;)
{
auto copy_iter = iter++;
+ LLUUID id = copy_iter->first;
//skinbytes += U64Bytes(sizeof(LLMeshSkinInfo));
//skinbytes += U64Bytes(copy_iter->second->mJointNames.size() * sizeof(std::string));
@@ -3870,6 +3955,12 @@ void LLMeshRepository::notifyLoadedMeshes()
{
mSkinMap.erase(copy_iter);
}
+
+ // erase from background thread
+ mThread->mWorkQueue.post([=]()
+ {
+ mThread->mSkinMap.erase(id);
+ });
}
//LL_INFOS() << "Skin info cache elements:" << mSkinMap.size() << " Memory: " << U64Kilobytes(skinbytes) << LL_ENDL;
}
@@ -4206,7 +4297,7 @@ void LLMeshRepository::fetchPhysicsShape(const LLUUID& mesh_id)
{
LLMutexLock lock(mMeshMutex);
//add volume to list of loading meshes
- std::set<LLUUID>::iterator iter = mLoadingPhysicsShapes.find(mesh_id);
+ std::unordered_set<LLUUID>::iterator iter = mLoadingPhysicsShapes.find(mesh_id);
if (iter == mLoadingPhysicsShapes.end())
{ //no request pending for this skin info
// *FIXME: Nothing ever deletes entries, can't be right
@@ -4236,7 +4327,7 @@ LLModel::Decomposition* LLMeshRepository::getDecomposition(const LLUUID& mesh_id
{
LLMutexLock lock(mMeshMutex);
//add volume to list of loading meshes
- std::set<LLUUID>::iterator iter = mLoadingDecompositions.find(mesh_id);
+ std::unordered_set<LLUUID>::iterator iter = mLoadingDecompositions.find(mesh_id);
if (iter == mLoadingDecompositions.end())
{ //no request pending for this skin info
mLoadingDecompositions.insert(mesh_id);
@@ -4287,6 +4378,8 @@ bool LLMeshRepository::hasPhysicsShape(const LLUUID& mesh_id)
bool LLMeshRepository::hasSkinInfo(const LLUUID& mesh_id)
{
+ LL_PROFILE_ZONE_SCOPED;
+
if (mesh_id.isNull())
{
return false;
diff --git a/indra/newview/llmeshrepository.h b/indra/newview/llmeshrepository.h
index b850ade0bb..d864a07615 100644
--- a/indra/newview/llmeshrepository.h
+++ b/indra/newview/llmeshrepository.h
@@ -28,6 +28,7 @@
#define LL_MESH_REPOSITORY_H
#include <unordered_map>
+#include <unordered_set>
#include "llassettype.h"
#include "llmodel.h"
#include "lluuid.h"
@@ -341,7 +342,7 @@ public:
std::deque<UUIDBasedRequest> mSkinRequests;
// list of completed skin info requests
- std::deque<LLMeshSkinInfo*> mSkinInfoQ;
+ std::deque<LLPointer<LLMeshSkinInfo>> mSkinInfoQ;
// list of skin info requests that have failed or are unavailaibe
std::deque<UUIDBasedRequest> mSkinUnavailableQ;
@@ -368,9 +369,17 @@ public:
std::deque<LoadedMesh> mLoadedQ;
//map of pending header requests and currently desired LODs
- typedef boost::unordered_map<LLUUID, std::vector<S32> > pending_lod_map;
+ typedef std::unordered_map<LLUUID, std::vector<S32> > pending_lod_map;
pending_lod_map mPendingLOD;
+ // map of mesh ID to skin info (mirrors LLMeshRepository::mSkinMap)
+ /// NOTE: LLMeshRepository::mSkinMap is accessed very frequently, so maintain a copy here to avoid mutex overhead
+ typedef std::unordered_map<LLUUID, LLPointer<LLMeshSkinInfo>> skin_map;
+ skin_map mSkinMap;
+
+ // workqueue for processing generic requests
+ LL::WorkQueue mWorkQueue;
+
// llcorehttp library interface objects.
LLCore::HttpStatus mHttpStatus;
LLCore::HttpRequest * mHttpRequest;
@@ -380,7 +389,7 @@ public:
LLCore::HttpRequest::policy_t mHttpPolicyClass;
LLCore::HttpRequest::policy_t mHttpLargePolicyClass;
- typedef std::set<LLCore::HttpHandler::ptr_t> http_request_set;
+ typedef std::unordered_set<LLCore::HttpHandler::ptr_t> http_request_set;
http_request_set mHttpRequestSet; // Outstanding HTTP requests
std::string mGetMeshCapability;
@@ -632,10 +641,12 @@ public:
LLMeshRepository();
void init();
+ void unregisterAllMeshes();
void shutdown();
S32 update();
- void unregisterMesh(LLVOVolume* volume);
+ void unregisterMesh(LLVOVolume* vobj, const LLVolumeParams& mesh_params, S32 detail);
+ void unregisterSkinInfo(const LLUUID& mesh_id, LLVOVolume* vobj);
//mesh management functions
S32 loadMesh(LLVOVolume* volume, const LLVolumeParams& mesh_params, S32 detail = 0, S32 last_lod = -1);
@@ -696,13 +707,13 @@ public:
std::queue<LLUUID> mPendingSkinRequests;
//list of mesh ids awaiting decompositions
- std::set<LLUUID> mLoadingDecompositions;
+ std::unordered_set<LLUUID> mLoadingDecompositions;
//list of mesh ids that need to send decomposition fetch requests
std::queue<LLUUID> mPendingDecompositionRequests;
//list of mesh ids awaiting physics shapes
- std::set<LLUUID> mLoadingPhysicsShapes;
+ std::unordered_set<LLUUID> mLoadingPhysicsShapes;
//list of mesh ids that need to send physics shape fetch requests
std::queue<LLUUID> mPendingPhysicsShapeRequests;
diff --git a/indra/newview/llmodelpreview.cpp b/indra/newview/llmodelpreview.cpp
index ef09cfa55b..1e8b7d39cc 100644
--- a/indra/newview/llmodelpreview.cpp
+++ b/indra/newview/llmodelpreview.cpp
@@ -134,25 +134,17 @@ std::string getLodSuffix(S32 lod)
void FindModel(LLModelLoader::scene& scene, const std::string& name_to_match, LLModel*& baseModelOut, LLMatrix4& matOut)
{
- LLModelLoader::scene::iterator base_iter = scene.begin();
- bool found = false;
- while (!found && (base_iter != scene.end()))
+ for (auto scene_iter = scene.begin(); scene_iter != scene.end(); scene_iter++)
{
- matOut = base_iter->first;
-
- LLModelLoader::model_instance_list::iterator base_instance_iter = base_iter->second.begin();
- while (!found && (base_instance_iter != base_iter->second.end()))
+ for (auto model_iter = scene_iter->second.begin(); model_iter != scene_iter->second.end(); model_iter++)
{
- LLModelInstance& base_instance = *base_instance_iter++;
- LLModel* base_model = base_instance.mModel;
-
- if (base_model && (base_model->mLabel == name_to_match))
+ if (model_iter->mModel && (model_iter->mModel->mLabel == name_to_match))
{
- baseModelOut = base_model;
+ baseModelOut = model_iter->mModel;
+ matOut = scene_iter->first;
return;
}
}
- base_iter++;
}
}
@@ -212,9 +204,12 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp)
LLModelPreview::~LLModelPreview()
{
+ LLMutexLock lock(this);
+
if (mModelLoader)
{
mModelLoader->shutdown();
+ mModelLoader = NULL;
}
if (mPreviewAvatar)
@@ -262,7 +257,7 @@ void LLModelPreview::updateDimentionsAndOffsets()
accounted.insert(instance.mModel);
// update instance skin info for each lods pelvisZoffset
- for (int j = 0; j<LLModel::NUM_LODS; ++j)
+ for (int j = 0; j < LLModel::NUM_LODS; ++j)
{
if (instance.mLOD[j])
{
@@ -303,7 +298,7 @@ void LLModelPreview::rebuildUploadData()
bool legacyMatching = gSavedSettings.getBOOL("ImporterLegacyMatching");
U32 load_state = 0;
- for (LLModelLoader::scene::iterator iter = mBaseScene.begin(); iter != mBaseScene.end(); ++iter)
+ for (auto iter = mBaseScene.begin(); iter != mBaseScene.end(); ++iter)
{ //for each transform in scene
LLMatrix4 mat = iter->first;
@@ -322,9 +317,9 @@ void LLModelPreview::rebuildUploadData()
mat *= scale_mat;
- for (LLModelLoader::model_instance_list::iterator model_iter = iter->second.begin(); model_iter != iter->second.end();)
+ for (auto model_iter = iter->second.begin(); model_iter != iter->second.end(); ++model_iter)
{ // for each instance with said transform applied
- LLModelInstance instance = *model_iter++;
+ LLModelInstance instance = *model_iter;
LLModel* base_model = instance.mModel;
@@ -910,7 +905,7 @@ void LLModelPreview::clearIncompatible(S32 lod)
{
mBaseModel = mModel[lod];
mBaseScene = mScene[lod];
- mVertexBuffer[5].clear();
+ mVertexBuffer[LLModel::NUM_LODS].clear();
replaced_base_model = true;
}
}
@@ -1132,7 +1127,7 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod)
mBaseModel = mModel[loaded_lod];
mBaseScene = mScene[loaded_lod];
- mVertexBuffer[5].clear();
+ mVertexBuffer[LLModel::NUM_LODS].clear();
}
else
{
@@ -1248,7 +1243,7 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod)
{
if (!mBaseModel.empty())
{
- const std::string& model_name = mBaseModel[0]->getName();
+ std::string model_name = mBaseModel.front()->getName();
LLLineEditor* description_form = mFMP->getChild<LLLineEditor>("description_form");
if (description_form->getText().empty())
{
@@ -1269,6 +1264,8 @@ void LLModelPreview::loadModelCallback(S32 loaded_lod)
void LLModelPreview::resetPreviewTarget()
{
+ LLMutexLock lock(this);
+
if (mModelLoader)
{
mPreviewTarget = (mModelLoader->mExtents[0] + mModelLoader->mExtents[1]) * 0.5f;
@@ -1314,7 +1311,7 @@ void LLModelPreview::generateNormals()
(*it)->generateNormals(angle_cutoff);
}
- mVertexBuffer[5].clear();
+ mVertexBuffer[LLModel::NUM_LODS].clear();
}
bool perform_copy = mModelFacesCopy[which_lod].empty();
@@ -2156,7 +2153,7 @@ void LLModelPreview::updateStatusMessages()
S32 total_verts[LLModel::NUM_LODS];
S32 total_submeshes[LLModel::NUM_LODS];
- for (U32 i = 0; i < LLModel::NUM_LODS - 1; i++)
+ for (U32 i = 0; i < LLModel::NUM_LODS; i++)
{
total_tris[i] = 0;
total_verts[i] = 0;
@@ -2460,12 +2457,16 @@ void LLModelPreview::updateStatusMessages()
}
}
- if (mModelNoErrors && mModelLoader)
+ if (mModelNoErrors)
{
- if (!mModelLoader->areTexturesReady() && mFMP->childGetValue("upload_textures").asBoolean())
+ LLMutexLock lock(this);
+ if (mModelLoader)
{
- // Some textures are still loading, prevent upload until they are done
- mModelNoErrors = false;
+ if (!mModelLoader->areTexturesReady() && mFMP->childGetValue("upload_textures").asBoolean())
+ {
+ // Some textures are still loading, prevent upload until they are done
+ mModelNoErrors = false;
+ }
}
}
@@ -2794,10 +2795,10 @@ void LLModelPreview::genBuffers(S32 lod, bool include_skin_weights)
{
LLModelLoader::model_list* model = NULL;
- if (lod < 0 || lod > 4)
+ if (lod < 0 || lod >= LLModel::NUM_LODS)
{
model = &mBaseModel;
- lod = 5;
+ lod = LLModel::NUM_LODS;
}
else
{
@@ -3034,8 +3035,9 @@ void LLModelPreview::loadedCallback(
S32 lod,
void* opaque)
{
- LLModelPreview* pPreview = static_cast< LLModelPreview* >(opaque);
- if (pPreview && !LLModelPreview::sIgnoreLoadedCallback)
+ LLModelPreview* pPreview = static_cast<LLModelPreview*>(opaque);
+ LLMutexLock lock(pPreview);
+ if (pPreview && pPreview->mModelLoader && !LLModelPreview::sIgnoreLoadedCallback)
{
// Load loader's warnings into floater's log tab
const LLSD out = pPreview->mModelLoader->logOut();
@@ -3056,7 +3058,9 @@ void LLModelPreview::loadedCallback(
}
const LLVOAvatar* avatarp = pPreview->getPreviewAvatar();
- if (avatarp) { // set up ground plane for possible rendering
+ if (avatarp && avatarp->mRoot && avatarp->mDrawable)
+ {
+ // set up ground plane for possible rendering
const LLVector3 root_pos = avatarp->mRoot->getPosition();
const LLVector4a* ext = avatarp->mDrawable->getSpatialExtents();
const LLVector4a min = ext[0], max = ext[1];
@@ -3200,12 +3204,12 @@ bool LLModelPreview::render()
LLMutexLock lock(this);
mNeedsUpdate = false;
- bool edges = mViewOption["show_edges"];
- bool joint_overrides = mViewOption["show_joint_overrides"];
- bool joint_positions = mViewOption["show_joint_positions"];
- bool skin_weight = mViewOption["show_skin_weight"];
- bool textures = mViewOption["show_textures"];
- bool physics = mViewOption["show_physics"];
+ bool show_edges = mViewOption["show_edges"];
+ bool show_joint_overrides = mViewOption["show_joint_overrides"];
+ bool show_joint_positions = mViewOption["show_joint_positions"];
+ bool show_skin_weight = mViewOption["show_skin_weight"];
+ bool show_textures = mViewOption["show_textures"];
+ bool show_physics = mViewOption["show_physics"];
S32 width = getWidth();
S32 height = getHeight();
@@ -3282,15 +3286,15 @@ bool LLModelPreview::render()
fmp->childSetValue("upload_skin", true);
mFirstSkinUpdate = false;
upload_skin = true;
- skin_weight = true;
+ show_skin_weight = true;
mViewOption["show_skin_weight"] = true;
}
fmp->enableViewOption("show_skin_weight");
- fmp->setViewOptionEnabled("show_joint_overrides", skin_weight);
- fmp->setViewOptionEnabled("show_joint_positions", skin_weight);
+ fmp->setViewOptionEnabled("show_joint_overrides", show_skin_weight);
+ fmp->setViewOptionEnabled("show_joint_positions", show_skin_weight);
mFMP->childEnable("upload_skin");
- mFMP->childSetValue("show_skin_weight", skin_weight);
+ mFMP->childSetValue("show_skin_weight", show_skin_weight);
}
else if ((flags & LEGACY_RIG_FLAG_TOO_MANY_JOINTS) > 0)
@@ -3313,11 +3317,12 @@ bool LLModelPreview::render()
fmp->disableViewOption("show_joint_overrides");
fmp->disableViewOption("show_joint_positions");
- skin_weight = false;
+ show_skin_weight = false;
mFMP->childSetValue("show_skin_weight", false);
- fmp->setViewOptionEnabled("show_skin_weight", skin_weight);
+ fmp->setViewOptionEnabled("show_skin_weight", show_skin_weight);
}
}
+ //if (this) return TRUE;
if (upload_skin && !has_skin_weights)
{ //can't upload skin weights if model has no skin weights
@@ -3380,7 +3385,7 @@ bool LLModelPreview::render()
F32 z_near = 0.001f;
F32 z_far = mCameraDistance*10.0f + mPreviewScale.magVec() + mCameraOffset.magVec();
- if (skin_weight)
+ if (show_skin_weight)
{
target_pos = getPreviewAvatar()->getPositionAgent() + offset;
z_near = 0.01f;
@@ -3390,7 +3395,7 @@ bool LLModelPreview::render()
refresh();
}
- gObjectPreviewProgram.bind(skin_weight);
+ gObjectPreviewProgram.bind(show_skin_weight);
gGL.loadIdentity();
gPipeline.enableLightsPreview();
@@ -3399,7 +3404,7 @@ bool LLModelPreview::render()
LLQuaternion(mCameraYaw, LLVector3::z_axis);
LLQuaternion av_rot = camera_rot;
- F32 camera_distance = skin_weight ? SKIN_WEIGHT_CAMERA_DISTANCE : mCameraDistance;
+ F32 camera_distance = show_skin_weight ? SKIN_WEIGHT_CAMERA_DISTANCE : mCameraDistance;
LLViewerCamera::getInstance()->setOriginAndLookAt(
target_pos + ((LLVector3(camera_distance, 0.f, 0.f) + offset) * av_rot), // camera
LLVector3::z_axis, // up
@@ -3415,9 +3420,9 @@ bool LLModelPreview::render()
gGL.pushMatrix();
gGL.color4fv(PREVIEW_EDGE_COL.mV);
- if (!mBaseModel.empty() && mVertexBuffer[5].empty())
+ if (!mBaseModel.empty() && mVertexBuffer[LLModel::NUM_LODS].empty())
{
- genBuffers(-1, skin_weight);
+ genBuffers(-1, show_skin_weight);
//genBuffers(3);
}
@@ -3432,7 +3437,7 @@ bool LLModelPreview::render()
if (!vb_vec.empty())
{
const LLVertexBuffer* buff = vb_vec[0];
- regen = buff->hasDataType(LLVertexBuffer::TYPE_WEIGHT4) != skin_weight;
+ regen = buff->hasDataType(LLVertexBuffer::TYPE_WEIGHT4) != show_skin_weight;
}
else
{
@@ -3443,15 +3448,15 @@ bool LLModelPreview::render()
if (regen)
{
- genBuffers(mPreviewLOD, skin_weight);
+ genBuffers(mPreviewLOD, show_skin_weight);
}
- if (physics && mVertexBuffer[LLModel::LOD_PHYSICS].empty())
+ if (show_physics && mVertexBuffer[LLModel::LOD_PHYSICS].empty())
{
genBuffers(LLModel::LOD_PHYSICS, false);
}
- if (!skin_weight)
+ if (!show_skin_weight)
{
for (LLMeshUploadThread::instance_list::iterator iter = mUploadData.begin(); iter != mUploadData.end(); ++iter)
{
@@ -3473,11 +3478,7 @@ bool LLModelPreview::render()
auto num_models = mVertexBuffer[mPreviewLOD][model].size();
for (size_t i = 0; i < num_models; ++i)
{
- LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i];
-
- buffer->setBuffer();
-
- if (textures)
+ if (show_textures)
{
auto materialCnt = instance.mModel->mMaterialList.size();
if (i < materialCnt)
@@ -3501,10 +3502,16 @@ bool LLModelPreview::render()
gGL.diffuseColor4fv(PREVIEW_BASE_COL.mV);
}
+ // Zero this variable for an obligatory buffer initialization
+ // See https://github.com/secondlife/viewer/issues/912
+ LLVertexBuffer::sGLRenderBuffer = 0;
+ LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i];
+ buffer->setBuffer();
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0);
+
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.diffuseColor4fv(PREVIEW_EDGE_COL.mV);
- if (edges)
+ if (show_edges)
{
glLineWidth(PREVIEW_EDGE_WIDTH);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
@@ -3517,7 +3524,7 @@ bool LLModelPreview::render()
gGL.popMatrix();
}
- if (physics)
+ if (show_physics)
{
glClear(GL_DEPTH_BUFFER_BIT);
@@ -3621,11 +3628,13 @@ bool LLModelPreview::render()
if (pass > 0){
for (size_t i = 0; i < num_models; ++i)
{
- LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i];
-
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.diffuseColor4fv(PREVIEW_PSYH_FILL_COL.mV);
+ // Zero this variable for an obligatory buffer initialization
+ // See https://github.com/secondlife/viewer/issues/912
+ LLVertexBuffer::sGLRenderBuffer = 0;
+ LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][i];
buffer->setBuffer();
buffer->drawRange(LLRender::TRIANGLES, 0, buffer->getNumVerts() - 1, buffer->getNumIndices(), 0);
@@ -3685,10 +3694,11 @@ bool LLModelPreview::render()
auto num_models = mVertexBuffer[LLModel::LOD_PHYSICS][model].size();
for (size_t v = 0; v < num_models; ++v)
{
+ // Zero this variable for an obligatory buffer initialization
+ // See https://github.com/secondlife/viewer/issues/912
+ LLVertexBuffer::sGLRenderBuffer = 0;
LLVertexBuffer* buffer = mVertexBuffer[LLModel::LOD_PHYSICS][model][v];
-
buffer->setBuffer();
-
LLStrider<LLVector3> pos_strider;
buffer->getVertexStrider(pos_strider, 0);
LLVector4a* pos = (LLVector4a*)pos_strider.get();
@@ -3752,7 +3762,7 @@ bool LLModelPreview::render()
U32 joint_count = LLSkinningUtil::getMeshJointCount(skin);
auto bind_count = skin->mAlternateBindMatrix.size();
- if (joint_overrides
+ if (show_joint_overrides
&& bind_count > 0
&& joint_count == bind_count)
{
@@ -3797,14 +3807,12 @@ bool LLModelPreview::render()
for (U32 i = 0, e = static_cast<U32>(mVertexBuffer[mPreviewLOD][model].size()); i < e; ++i)
{
- LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i];
-
model->mSkinInfo.updateHash();
LLRenderPass::uploadMatrixPalette(mPreviewAvatar, &model->mSkinInfo);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- if (textures)
+ if (show_textures)
{
auto materialCnt = instance.mModel->mMaterialList.size();
if (i < materialCnt)
@@ -3828,10 +3836,14 @@ bool LLModelPreview::render()
gGL.diffuseColor4fv(PREVIEW_BASE_COL.mV);
}
+ // Zero this variable for an obligatory buffer initialization
+ // See https://github.com/secondlife/viewer/issues/912
+ LLVertexBuffer::sGLRenderBuffer = 0;
+ LLVertexBuffer* buffer = mVertexBuffer[mPreviewLOD][model][i];
buffer->setBuffer();
buffer->draw(LLRender::TRIANGLES, buffer->getNumIndices(), 0);
- if (edges)
+ if (show_edges)
{
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.diffuseColor4fv(PREVIEW_EDGE_COL.mV);
@@ -3846,7 +3858,7 @@ bool LLModelPreview::render()
}
}
- if (joint_positions)
+ if (show_joint_positions)
{
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
if (shader)
diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp
index 957948b3fe..483ddcdd63 100644
--- a/indra/newview/llnetmap.cpp
+++ b/indra/newview/llnetmap.cpp
@@ -298,15 +298,22 @@ void LLNetMap::draw()
// Draw using texture.
gGL.getTexUnit(0)->bind(regionp->getLand().getSTexture());
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
+ {
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(left, top);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(left, bottom);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(right, bottom);
+
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2f(left, top);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2f(right, bottom);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(right, top);
+ }
gGL.end();
gGL.flush();
@@ -347,15 +354,22 @@ void LLNetMap::draw()
F32 image_half_width = 0.5f*mObjectMapPixels;
F32 image_half_height = 0.5f*mObjectMapPixels;
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
+ {
gGL.texCoord2f(0.f, 1.f);
gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, image_half_height + map_center_agent.mV[VY]);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, map_center_agent.mV[VY] - image_half_height);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex2f(image_half_width + map_center_agent.mV[VX], map_center_agent.mV[VY] - image_half_height);
+
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex2f(map_center_agent.mV[VX] - image_half_width, image_half_height + map_center_agent.mV[VY]);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex2f(image_half_width + map_center_agent.mV[VX], map_center_agent.mV[VY] - image_half_height);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex2f(image_half_width + map_center_agent.mV[VX], image_half_height + map_center_agent.mV[VY]);
+ }
gGL.end();
for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin();
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 40b42b165b..0233a22c2a 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -924,8 +924,8 @@ void LLOutfitListBase::onIdleRefreshList()
if (cat)
{
std::string name = cat->getName();
- updateChangedCategoryName(cat, name);
- }
+ updateChangedCategoryName(cat, name);
+ }
curent_time = LLTimer::getTotalSeconds();
if (curent_time >= end_time)
diff --git a/indra/newview/llpanelemojicomplete.cpp b/indra/newview/llpanelemojicomplete.cpp
index 7f72677e34..0d6ca1cb94 100644
--- a/indra/newview/llpanelemojicomplete.cpp
+++ b/indra/newview/llpanelemojicomplete.cpp
@@ -68,6 +68,9 @@ LLPanelEmojiComplete::LLPanelEmojiComplete(const LLPanelEmojiComplete::Params& p
{
LLScrollbar::Params sbparams;
sbparams.orientation(LLScrollbar::VERTICAL);
+ sbparams.doc_size((S32)mTotalEmojis);
+ sbparams.doc_pos(0);
+ sbparams.page_size((S32)mVisibleEmojis);
sbparams.change_callback([this](S32 index, LLScrollbar*) { onScrollbarChange(index); });
mScrollbar = LLUICtrlFactory::create<LLScrollbar>(sbparams);
addChild(mScrollbar);
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp
index 5f8a6fa537..7a63c6e10d 100644
--- a/indra/newview/llpanelface.cpp
+++ b/indra/newview/llpanelface.cpp
@@ -5199,4 +5199,3 @@ void LLPanelFace::LLSelectedTE::getMaxDiffuseRepeats(F32& repeats, bool& identic
} max_diff_repeats_func;
identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &max_diff_repeats_func, repeats );
}
-
diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h
index dfd3201533..4d2ce208b4 100644
--- a/indra/newview/llpanelface.h
+++ b/indra/newview/llpanelface.h
@@ -479,7 +479,7 @@ private:
ReturnType (LLMaterial::* const MaterialGetFunc)() const >
static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value, bool has_tolerance = false, DataType tolerance = DataType())
{
- DataType data_value;
+ DataType data_value{};
struct GetTEMaterialVal : public LLSelectedTEGetFunctor<DataType>
{
GetTEMaterialVal(DataType default_value) : _default(default_value) {}
@@ -512,7 +512,7 @@ private:
ReturnType (LLTextureEntry::* const TEGetFunc)() const >
static void getTEValue(DataType& data_to_return, bool& identical, DataType default_value, bool has_tolerance = false, DataType tolerance = DataType())
{
- DataType data_value;
+ DataType data_value {};
struct GetTEVal : public LLSelectedTEGetFunctor<DataType>
{
GetTEVal(DataType default_value) : _default(default_value) {}
@@ -707,4 +707,3 @@ public:
};
#endif
-
diff --git a/indra/newview/llpanelgroupbulk.cpp b/indra/newview/llpanelgroupbulk.cpp
index 433db74cda..8032e207cd 100644
--- a/indra/newview/llpanelgroupbulk.cpp
+++ b/indra/newview/llpanelgroupbulk.cpp
@@ -56,6 +56,7 @@ LLPanelGroupBulkImpl::LLPanelGroupBulkImpl(const LLUUID& group_id) :
mGroupID(group_id),
mBulkAgentList(NULL),
mOKButton(NULL),
+ mAddButton(nullptr),
mRemoveButton(NULL),
mGroupName(NULL),
mLoadingText(),
@@ -79,29 +80,18 @@ LLPanelGroupBulkImpl::~LLPanelGroupBulkImpl()
}
}
-// static
-void LLPanelGroupBulkImpl::callbackClickAdd(void* userdata)
+void LLPanelGroupBulkImpl::callbackClickAdd(LLPanelGroupBulk* panelp)
{
- if (LLPanelGroupBulk* panelp = (LLPanelGroupBulk*)userdata)
- {
- // Right now this is hard coded with some knowledge that it is part
- // of a floater since the avatar picker needs to be added as a dependent
- // floater to the parent floater.
- // Soon the avatar picker will be embedded into this panel
- // instead of being it's own separate floater. But that is next week.
- // This will do for now. -jwolk May 10, 2006
- LLView* button = panelp->findChild<LLButton>("add_button");
- LLFloater* root_floater = gFloaterView->getParentFloater(panelp);
- LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
- [&](const uuid_vec_t& agent_ids, const std::vector<LLAvatarName>&)
- {
- panelp->mImplementation->addUsers(agent_ids);
- }, true, false, false, root_floater->getName(), button);
- if (picker)
+ LLFloater* root_floater = gFloaterView->getParentFloater(panelp);
+ LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
+ [this](const uuid_vec_t& agent_ids, const std::vector<LLAvatarName>&)
{
- root_floater->addDependentFloater(picker);
- LLGroupMgr::getInstance()->sendCapGroupMembersRequest(panelp->mImplementation->mGroupID);
- }
+ addUsers(agent_ids);
+ }, true, false, false, root_floater->getName(), mAddButton);
+ if (picker)
+ {
+ root_floater->addDependentFloater(picker);
+ LLGroupMgr::getInstance()->sendCapGroupMembersRequest(mGroupID);
}
}
diff --git a/indra/newview/llpanelgroupbulkban.cpp b/indra/newview/llpanelgroupbulkban.cpp
index 3c764887a6..1d3edad0f3 100644
--- a/indra/newview/llpanelgroupbulkban.cpp
+++ b/indra/newview/llpanelgroupbulkban.cpp
@@ -68,35 +68,26 @@ bool LLPanelGroupBulkBan::postBuild()
mImplementation->mBulkAgentList->setCommitCallback(LLPanelGroupBulkImpl::callbackSelect, mImplementation);
}
- LLButton* button = getChild<LLButton>("add_button", recurse);
- if ( button )
+ mImplementation->mAddButton = getChild<LLButton>("add_button", recurse);
+ // default to opening avatarpicker automatically
+ mImplementation->mAddButton->setClickedCallback(
+ [this](LLUICtrl* ctrl, const LLSD& param)
{
- // default to opening avatarpicker automatically
- // (*impl::callbackClickAdd)((void*)this);
- button->setClickedCallback(LLPanelGroupBulkImpl::callbackClickAdd, this);
- }
+ mImplementation->callbackClickAdd(this);
+ });
mImplementation->mRemoveButton =
getChild<LLButton>("remove_button", recurse);
- if ( mImplementation->mRemoveButton )
- {
- mImplementation->mRemoveButton->setClickedCallback(LLPanelGroupBulkImpl::callbackClickRemove, mImplementation);
- mImplementation->mRemoveButton->setEnabled(false);
- }
+ mImplementation->mRemoveButton->setClickedCallback(LLPanelGroupBulkImpl::callbackClickRemove, mImplementation);
+ mImplementation->mRemoveButton->setEnabled(false);
mImplementation->mOKButton =
getChild<LLButton>("ban_button", recurse);
- if ( mImplementation->mOKButton )
- {
- mImplementation->mOKButton->setClickedCallback(LLPanelGroupBulkBan::callbackClickSubmit, this);
- mImplementation->mOKButton->setEnabled(false);
- }
+ mImplementation->mOKButton->setClickedCallback(LLPanelGroupBulkBan::callbackClickSubmit, this);
+ mImplementation->mOKButton->setEnabled(false);
- button = getChild<LLButton>("cancel_button", recurse);
- if ( button )
- {
- button->setClickedCallback(LLPanelGroupBulkImpl::callbackClickCancel, mImplementation);
- }
+ LLButton* button = getChild<LLButton>("cancel_button", recurse);
+ button->setClickedCallback(LLPanelGroupBulkImpl::callbackClickCancel, mImplementation);
mImplementation->mTooManySelected = getString("ban_selection_too_large");
mImplementation->mBanNotPermitted = getString("ban_not_permitted");
diff --git a/indra/newview/llpanelgroupbulkimpl.h b/indra/newview/llpanelgroupbulkimpl.h
index 5a479f8117..5515bd6d9a 100644
--- a/indra/newview/llpanelgroupbulkimpl.h
+++ b/indra/newview/llpanelgroupbulkimpl.h
@@ -44,7 +44,7 @@ public:
LLPanelGroupBulkImpl(const LLUUID& group_id);
~LLPanelGroupBulkImpl();
- static void callbackClickAdd(void* userdata);
+ void callbackClickAdd(LLPanelGroupBulk* panelp);
static void callbackClickRemove(void* userdata);
static void callbackClickCancel(void* userdata);
@@ -70,6 +70,7 @@ public:
LLNameListCtrl* mBulkAgentList;
LLButton* mOKButton;
+ LLButton* mAddButton;
LLButton* mRemoveButton;
LLTextBox* mGroupName;
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 8bc5989b89..48f32a05ba 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -78,9 +78,9 @@ static LLPanelInjector<LLPanelMainInventory> t_inventory("panel_main_inventory")
class LLFloaterInventoryFinder : public LLFloater
{
public:
- LLFloaterInventoryFinder( LLPanelMainInventory* inventory_view);
- virtual void draw();
- /*virtual*/ bool postBuild();
+ LLFloaterInventoryFinder(LLPanelMainInventory* inventory_view);
+ void draw();
+ bool postBuild();
void changeFilter(LLInventoryFilter* filter);
void updateElementsFromFilter();
bool getCheckShowEmpty();
@@ -90,17 +90,35 @@ public:
void onCreatorSelfFilterCommit();
void onCreatorOtherFilterCommit();
- static void onTimeAgo(LLUICtrl*, void *);
- static void onCloseBtn(void* user_data);
- static void selectAllTypes(void* user_data);
- static void selectNoTypes(void* user_data);
+ void onTimeAgo();
+ void onCloseBtn();
+ void selectAllTypes();
+ void selectNoTypes();
private:
- LLPanelMainInventory* mPanelMainInventory;
- LLSpinCtrl* mSpinSinceDays;
- LLSpinCtrl* mSpinSinceHours;
- LLCheckBoxCtrl* mCreatorSelf;
- LLCheckBoxCtrl* mCreatorOthers;
- LLInventoryFilter* mFilter;
+ LLPanelMainInventory* mPanelMainInventory{ nullptr };
+ LLSpinCtrl* mSpinSinceDays{ nullptr };
+ LLSpinCtrl* mSpinSinceHours{ nullptr };
+ LLCheckBoxCtrl* mCreatorSelf{ nullptr };
+ LLCheckBoxCtrl* mCreatorOthers{ nullptr };
+ LLInventoryFilter* mFilter{ nullptr };
+
+ LLCheckBoxCtrl* mCheckAnimation{ nullptr };
+ LLCheckBoxCtrl* mCheckCallingCard{ nullptr };
+ LLCheckBoxCtrl* mCheckClothing{ nullptr };
+ LLCheckBoxCtrl* mCheckGesture{ nullptr };
+ LLCheckBoxCtrl* mCheckLandmark{ nullptr };
+ LLCheckBoxCtrl* mCheckMaterial{ nullptr };
+ LLCheckBoxCtrl* mCheckNotecard{ nullptr };
+ LLCheckBoxCtrl* mCheckObject{ nullptr };
+ LLCheckBoxCtrl* mCheckScript{ nullptr };
+ LLCheckBoxCtrl* mCheckSounds{ nullptr };
+ LLCheckBoxCtrl* mCheckTexture{ nullptr };
+ LLCheckBoxCtrl* mCheckSnapshot{ nullptr };
+ LLCheckBoxCtrl* mCheckSettings{ nullptr };
+ LLCheckBoxCtrl* mCheckShowEmpty{ nullptr };
+ LLCheckBoxCtrl* mCheckSinceLogoff{ nullptr };
+
+ LLRadioGroup* mRadioDateSearchDirection{ nullptr };
};
///----------------------------------------------------------------------------
@@ -736,7 +754,6 @@ bool LLPanelMainInventory::filtersVisible(void* user_data)
void LLPanelMainInventory::onClearSearch()
{
bool initially_active = false;
- LLFloater *finder = getFinder();
if (mActivePanel && (getActivePanel() != mWornItemsPanel))
{
initially_active = mActivePanel->getFilter().isNotDefault();
@@ -745,9 +762,9 @@ void LLPanelMainInventory::onClearSearch()
mActivePanel->setFilterLinks(LLInventoryFilter::FILTERLINK_INCLUDE_LINKS);
}
- if (finder)
+ if (LLFloaterInventoryFinder* finder = getFinder())
{
- LLFloaterInventoryFinder::selectAllTypes(finder);
+ finder->selectAllTypes();
}
// re-open folders that were initially open in case filter was active
@@ -1147,36 +1164,53 @@ bool LLFloaterInventoryFinder::postBuild()
const LLRect& viewrect = mPanelMainInventory->getRect();
setRect(LLRect(viewrect.mLeft - getRect().getWidth(), viewrect.mTop, viewrect.mLeft, viewrect.mTop - getRect().getHeight()));
- childSetAction("All", selectAllTypes, this);
- childSetAction("None", selectNoTypes, this);
+ childSetAction("All", [this](LLUICtrl*, const LLSD&) { selectAllTypes(); });
+ childSetAction("None", [this](LLUICtrl*, const LLSD&) { selectNoTypes(); });
mSpinSinceHours = getChild<LLSpinCtrl>("spin_hours_ago");
- childSetCommitCallback("spin_hours_ago", onTimeAgo, this);
+ mSpinSinceHours->setCommitCallback([this](LLUICtrl*, const LLSD&) { onTimeAgo(); });
mSpinSinceDays = getChild<LLSpinCtrl>("spin_days_ago");
- childSetCommitCallback("spin_days_ago", onTimeAgo, this);
+ mSpinSinceDays->setCommitCallback([this](LLUICtrl*, const LLSD&) { onTimeAgo(); });
mCreatorSelf = getChild<LLCheckBoxCtrl>("check_created_by_me");
mCreatorOthers = getChild<LLCheckBoxCtrl>("check_created_by_others");
mCreatorSelf->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onCreatorSelfFilterCommit, this));
mCreatorOthers->setCommitCallback(boost::bind(&LLFloaterInventoryFinder::onCreatorOtherFilterCommit, this));
- childSetAction("Close", onCloseBtn, this);
+ mCheckAnimation = getChild<LLCheckBoxCtrl>("check_animation");
+ mCheckCallingCard = getChild<LLCheckBoxCtrl>("check_calling_card");
+ mCheckClothing = getChild<LLCheckBoxCtrl>("check_clothing");
+ mCheckGesture = getChild<LLCheckBoxCtrl>("check_gesture");
+ mCheckLandmark = getChild<LLCheckBoxCtrl>("check_landmark");
+ mCheckMaterial = getChild<LLCheckBoxCtrl>("check_material");
+ mCheckNotecard = getChild<LLCheckBoxCtrl>("check_notecard");
+ mCheckObject = getChild<LLCheckBoxCtrl>("check_object");
+ mCheckScript = getChild<LLCheckBoxCtrl>("check_script");
+ mCheckSounds = getChild<LLCheckBoxCtrl>("check_sound");
+ mCheckTexture = getChild<LLCheckBoxCtrl>("check_texture");
+ mCheckSnapshot = getChild<LLCheckBoxCtrl>("check_snapshot");
+ mCheckSettings = getChild<LLCheckBoxCtrl>("check_settings");
+ mCheckShowEmpty = getChild<LLCheckBoxCtrl>("check_show_empty");
+ mCheckSinceLogoff = getChild<LLCheckBoxCtrl>("check_since_logoff");
+
+ mRadioDateSearchDirection = getChild<LLRadioGroup>("date_search_direction");
+
+ childSetAction("Close", [this](LLUICtrl*, const LLSD&) { onCloseBtn(); });
updateElementsFromFilter();
+
return true;
}
-void LLFloaterInventoryFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data)
-{
- LLFloaterInventoryFinder *self = (LLFloaterInventoryFinder *)user_data;
- if (!self) return;
- if ( self->mSpinSinceDays->get() || self->mSpinSinceHours->get() )
+void LLFloaterInventoryFinder::onTimeAgo()
+{
+ if (mSpinSinceDays->get() || mSpinSinceHours->get())
{
- self->getChild<LLUICtrl>("check_since_logoff")->setValue(false);
+ mCheckSinceLogoff->setValue(false);
- U32 days = (U32)self->mSpinSinceDays->get();
- U32 hours = (U32)self->mSpinSinceHours->get();
+ U32 days = (U32)mSpinSinceDays->get();
+ U32 hours = (U32)mSpinSinceHours->get();
if (hours >= 24)
{
// Try to handle both cases of spinner clicking and text input in a sensible fashion as best as possible.
@@ -1192,11 +1226,11 @@ void LLFloaterInventoryFinder::onTimeAgo(LLUICtrl *ctrl, void *user_data)
days = hours / 24;
}
hours = (U32)hours % 24;
- self->mSpinSinceHours->setFocus(false);
- self->mSpinSinceDays->setFocus(false);
- self->mSpinSinceDays->set((F32)days);
- self->mSpinSinceHours->set((F32)hours);
- self->mSpinSinceHours->setFocus(true);
+ mSpinSinceHours->setFocus(false);
+ mSpinSinceDays->setFocus(false);
+ mSpinSinceDays->set((F32)days);
+ mSpinSinceHours->set((F32)hours);
+ mSpinSinceHours->setFocus(true);
}
}
}
@@ -1225,29 +1259,28 @@ void LLFloaterInventoryFinder::updateElementsFromFilter()
// update the ui elements
setTitle(mFilter->getName());
- getChild<LLUICtrl>("check_animation")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_ANIMATION));
-
- getChild<LLUICtrl>("check_calling_card")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_CALLINGCARD));
- getChild<LLUICtrl>("check_clothing")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_WEARABLE));
- getChild<LLUICtrl>("check_gesture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_GESTURE));
- getChild<LLUICtrl>("check_landmark")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LANDMARK));
- getChild<LLUICtrl>("check_material")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_MATERIAL));
- getChild<LLUICtrl>("check_notecard")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_NOTECARD));
- getChild<LLUICtrl>("check_object")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_OBJECT));
- getChild<LLUICtrl>("check_script")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LSL));
- getChild<LLUICtrl>("check_sound")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SOUND));
- getChild<LLUICtrl>("check_texture")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_TEXTURE));
- getChild<LLUICtrl>("check_snapshot")->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SNAPSHOT));
- getChild<LLUICtrl>("check_settings")->setValue((S32)(filter_types & 0x1 << LLInventoryType::IT_SETTINGS));
- getChild<LLUICtrl>("check_show_empty")->setValue(show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS);
-
- getChild<LLUICtrl>("check_created_by_me")->setValue(show_created_by_me);
- getChild<LLUICtrl>("check_created_by_others")->setValue(show_created_by_others);
-
- getChild<LLUICtrl>("check_since_logoff")->setValue(mFilter->isSinceLogoff());
+ mCheckAnimation->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_ANIMATION));
+ mCheckCallingCard->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_CALLINGCARD));
+ mCheckClothing->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_WEARABLE));
+ mCheckGesture->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_GESTURE));
+ mCheckLandmark->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LANDMARK));
+ mCheckMaterial->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_MATERIAL));
+ mCheckNotecard->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_NOTECARD));
+ mCheckObject->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_OBJECT));
+ mCheckScript->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_LSL));
+ mCheckSounds->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SOUND));
+ mCheckTexture->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_TEXTURE));
+ mCheckSnapshot->setValue((S32) (filter_types & 0x1 << LLInventoryType::IT_SNAPSHOT));
+ mCheckSettings->setValue((S32)(filter_types & 0x1 << LLInventoryType::IT_SETTINGS));
+ mCheckShowEmpty->setValue(show_folders == LLInventoryFilter::SHOW_ALL_FOLDERS);
+
+ mCreatorSelf->setValue(show_created_by_me);
+ mCreatorOthers->setValue(show_created_by_others);
+
+ mCheckSinceLogoff->setValue(mFilter->isSinceLogoff());
mSpinSinceHours->set((F32)(hours % 24));
mSpinSinceDays->set((F32)(hours / 24));
- getChild<LLRadioGroup>("date_search_direction")->setSelectedIndex(date_search_direction);
+ mRadioDateSearchDirection->setSelectedIndex(date_search_direction);
}
void LLFloaterInventoryFinder::draw()
@@ -1255,80 +1288,80 @@ void LLFloaterInventoryFinder::draw()
U64 filter = 0xffffffffffffffffULL;
bool filtered_by_all_types = true;
- if (!getChild<LLUICtrl>("check_animation")->getValue())
+ if (!mCheckAnimation->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_ANIMATION);
filtered_by_all_types = false;
}
- if (!getChild<LLUICtrl>("check_calling_card")->getValue())
+ if (!mCheckCallingCard->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_CALLINGCARD);
filtered_by_all_types = false;
}
- if (!getChild<LLUICtrl>("check_clothing")->getValue())
+ if (!mCheckClothing->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_WEARABLE);
filtered_by_all_types = false;
}
- if (!getChild<LLUICtrl>("check_gesture")->getValue())
+ if (!mCheckGesture->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_GESTURE);
filtered_by_all_types = false;
}
- if (!getChild<LLUICtrl>("check_landmark")->getValue())
+ if (!mCheckLandmark->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_LANDMARK);
filtered_by_all_types = false;
}
- if (!getChild<LLUICtrl>("check_material")->getValue())
+ if (!mCheckMaterial->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_MATERIAL);
filtered_by_all_types = false;
}
- if (!getChild<LLUICtrl>("check_notecard")->getValue())
+ if (!mCheckNotecard->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_NOTECARD);
filtered_by_all_types = false;
}
- if (!getChild<LLUICtrl>("check_object")->getValue())
+ if (!mCheckObject->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_OBJECT);
filter &= ~(0x1 << LLInventoryType::IT_ATTACHMENT);
filtered_by_all_types = false;
}
- if (!getChild<LLUICtrl>("check_script")->getValue())
+ if (!mCheckScript->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_LSL);
filtered_by_all_types = false;
}
- if (!getChild<LLUICtrl>("check_sound")->getValue())
+ if (!mCheckSounds->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_SOUND);
filtered_by_all_types = false;
}
- if (!getChild<LLUICtrl>("check_texture")->getValue())
+ if (!mCheckTexture->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_TEXTURE);
filtered_by_all_types = false;
}
- if (!getChild<LLUICtrl>("check_snapshot")->getValue())
+ if (!mCheckSnapshot->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_SNAPSHOT);
filtered_by_all_types = false;
}
- if (!getChild<LLUICtrl>("check_settings")->getValue())
+ if (!mCheckSettings->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_SETTINGS);
filtered_by_all_types = false;
@@ -1446,65 +1479,56 @@ void LLFloaterInventoryFinder::onCreatorOtherFilterCommit()
bool LLFloaterInventoryFinder::getCheckShowEmpty()
{
- return getChild<LLUICtrl>("check_show_empty")->getValue();
+ return mCheckShowEmpty->getValue();
}
bool LLFloaterInventoryFinder::getCheckSinceLogoff()
{
- return getChild<LLUICtrl>("check_since_logoff")->getValue();
+ return mCheckSinceLogoff->getValue();
}
U32 LLFloaterInventoryFinder::getDateSearchDirection()
{
- return getChild<LLRadioGroup>("date_search_direction")->getSelectedIndex();
+ return mRadioDateSearchDirection->getSelectedIndex();
}
-void LLFloaterInventoryFinder::onCloseBtn(void* user_data)
+void LLFloaterInventoryFinder::onCloseBtn()
{
- LLFloaterInventoryFinder* finderp = (LLFloaterInventoryFinder*)user_data;
- finderp->closeFloater();
+ closeFloater();
}
-// static
-void LLFloaterInventoryFinder::selectAllTypes(void* user_data)
-{
- LLFloaterInventoryFinder* self = (LLFloaterInventoryFinder*)user_data;
- if(!self) return;
-
- self->getChild<LLUICtrl>("check_animation")->setValue(true);
- self->getChild<LLUICtrl>("check_calling_card")->setValue(true);
- self->getChild<LLUICtrl>("check_clothing")->setValue(true);
- self->getChild<LLUICtrl>("check_gesture")->setValue(true);
- self->getChild<LLUICtrl>("check_landmark")->setValue(true);
- self->getChild<LLUICtrl>("check_material")->setValue(true);
- self->getChild<LLUICtrl>("check_notecard")->setValue(true);
- self->getChild<LLUICtrl>("check_object")->setValue(true);
- self->getChild<LLUICtrl>("check_script")->setValue(true);
- self->getChild<LLUICtrl>("check_sound")->setValue(true);
- self->getChild<LLUICtrl>("check_texture")->setValue(true);
- self->getChild<LLUICtrl>("check_snapshot")->setValue(true);
- self->getChild<LLUICtrl>("check_settings")->setValue(true);
+void LLFloaterInventoryFinder::selectAllTypes()
+{
+ mCheckAnimation->setValue(true);
+ mCheckCallingCard->setValue(true);
+ mCheckClothing->setValue(true);
+ mCheckGesture->setValue(true);
+ mCheckLandmark->setValue(true);
+ mCheckMaterial->setValue(true);
+ mCheckNotecard->setValue(true);
+ mCheckObject->setValue(true);
+ mCheckScript->setValue(true);
+ mCheckSounds->setValue(true);
+ mCheckTexture->setValue(true);
+ mCheckSnapshot->setValue(true);
+ mCheckSettings->setValue(true);
}
-//static
-void LLFloaterInventoryFinder::selectNoTypes(void* user_data)
-{
- LLFloaterInventoryFinder* self = (LLFloaterInventoryFinder*)user_data;
- if(!self) return;
-
- self->getChild<LLUICtrl>("check_animation")->setValue(false);
- self->getChild<LLUICtrl>("check_calling_card")->setValue(false);
- self->getChild<LLUICtrl>("check_clothing")->setValue(false);
- self->getChild<LLUICtrl>("check_gesture")->setValue(false);
- self->getChild<LLUICtrl>("check_landmark")->setValue(false);
- self->getChild<LLUICtrl>("check_material")->setValue(false);
- self->getChild<LLUICtrl>("check_notecard")->setValue(false);
- self->getChild<LLUICtrl>("check_object")->setValue(false);
- self->getChild<LLUICtrl>("check_script")->setValue(false);
- self->getChild<LLUICtrl>("check_sound")->setValue(false);
- self->getChild<LLUICtrl>("check_texture")->setValue(false);
- self->getChild<LLUICtrl>("check_snapshot")->setValue(false);
- self->getChild<LLUICtrl>("check_settings")->setValue(false);
+void LLFloaterInventoryFinder::selectNoTypes()
+{
+ mCheckAnimation->setValue(false);
+ mCheckCallingCard->setValue(false);
+ mCheckClothing->setValue(false);
+ mCheckGesture->setValue(false);
+ mCheckLandmark->setValue(false);
+ mCheckMaterial->setValue(false);
+ mCheckNotecard->setValue(false);
+ mCheckObject->setValue(false);
+ mCheckScript->setValue(false);
+ mCheckSounds->setValue(false);
+ mCheckTexture->setValue(false);
+ mCheckSnapshot->setValue(false);
+ mCheckSettings->setValue(false);
}
//////////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp
index 18588514f8..87f05f2028 100644
--- a/indra/newview/llpanelplaceprofile.cpp
+++ b/indra/newview/llpanelplaceprofile.cpp
@@ -629,6 +629,11 @@ void LLPanelPlaceProfile::updateCovenantText(const std::string &text)
mCovenantText->setText(text);
}
+void LLPanelPlaceProfile::updateCovenant(const LLTextBase* source)
+{
+ mCovenantText->copyContents(source);
+}
+
void LLPanelPlaceProfile::onForSaleBannerClick()
{
LLViewerParcelMgr* mgr = LLViewerParcelMgr::getInstance();
diff --git a/indra/newview/llpanelplaceprofile.h b/indra/newview/llpanelplaceprofile.h
index 45a20fb86a..f562be0f5d 100644
--- a/indra/newview/llpanelplaceprofile.h
+++ b/indra/newview/llpanelplaceprofile.h
@@ -31,6 +31,7 @@
class LLAccordionCtrl;
class LLIconCtrl;
+class LLTextBase;
class LLTextEditor;
class LLPanelPlaceProfile : public LLPanelPlaceInfo
@@ -60,6 +61,7 @@ public:
void updateEstateName(const std::string& name);
void updateEstateOwnerName(const std::string& name);
void updateCovenantText(const std::string &text);
+ void updateCovenant(const LLTextBase* source);
private:
void onForSaleBannerClick();
diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp
index 08f3d3af5a..11a10ebd2c 100644
--- a/indra/newview/llpanelprofilepicks.cpp
+++ b/indra/newview/llpanelprofilepicks.cpp
@@ -246,6 +246,8 @@ void LLPanelProfilePicks::onClickNewBtn()
select_tab(true).
label(pick_panel->getPickName()));
updateButtons();
+
+ pick_panel->addLocationChangedCallbacks();
}
void LLPanelProfilePicks::onClickDelete()
@@ -571,10 +573,12 @@ void LLPanelProfilePick::setAvatarId(const LLUUID& avatar_id)
{
mPickName->setEnabled(true);
mPickDescription->setEnabled(true);
+ mSetCurrentLocationButton->setVisible(true);
}
else
{
mSnapshotCtrl->setEnabled(false);
+ mSetCurrentLocationButton->setVisible(false);
}
}
@@ -585,6 +589,7 @@ bool LLPanelProfilePick::postBuild()
mSaveButton = getChild<LLButton>("save_changes_btn");
mCreateButton = getChild<LLButton>("create_changes_btn");
mCancelButton = getChild<LLButton>("cancel_changes_btn");
+ mSetCurrentLocationButton = getChild<LLButton>("set_to_curr_location_btn");
mSnapshotCtrl = getChild<LLTextureCtrl>("pick_snapshot");
mSnapshotCtrl->setCommitCallback(boost::bind(&LLPanelProfilePick::onSnapshotChanged, this));
@@ -597,6 +602,7 @@ bool LLPanelProfilePick::postBuild()
mSaveButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSave, this));
mCreateButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSave, this));
mCancelButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickCancel, this));
+ mSetCurrentLocationButton->setCommitCallback(boost::bind(&LLPanelProfilePick::onClickSetLocation, this));
mPickName->setKeystrokeCallback(boost::bind(&LLPanelProfilePick::onPickChanged, this, _1), NULL);
mPickName->setEnabled(false);
@@ -759,6 +765,32 @@ bool LLPanelProfilePick::isDirty() const
return false;
}
+void LLPanelProfilePick::onClickSetLocation()
+{
+ // Save location for later use.
+ setPosGlobal(gAgent.getPositionGlobal());
+
+ std::string parcel_name, region_name;
+
+ LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+ if (parcel)
+ {
+ mParcelId = parcel->getID();
+ parcel_name = parcel->getName();
+ }
+
+ LLViewerRegion* region = gAgent.getRegion();
+ if (region)
+ {
+ region_name = region->getName();
+ }
+
+ setPickLocation(createLocationText(getLocationNotice(), parcel_name, region_name, getPosGlobal()));
+
+ mLocationChanged = true;
+ enableSaveButton(true);
+}
+
void LLPanelProfilePick::onClickSave()
{
if (mRegionCallbackConnection.connected())
@@ -769,6 +801,10 @@ void LLPanelProfilePick::onClickSave()
{
mParcelCallbackConnection.disconnect();
}
+ if (mLocationChanged)
+ {
+ onClickSetLocation();
+ }
sendUpdate();
mLocationChanged = false;
@@ -816,6 +852,12 @@ void LLPanelProfilePick::processParcelInfo(const LLParcelData& parcel_data)
}
}
+void LLPanelProfilePick::addLocationChangedCallbacks()
+{
+ mRegionCallbackConnection = gAgent.addRegionChangedCallback([this]() { onClickSetLocation(); });
+ mParcelCallbackConnection = gAgent.addParcelChangedCallback([this]() { onClickSetLocation(); });
+}
+
void LLPanelProfilePick::sendUpdate()
{
LLPickData pick_data;
diff --git a/indra/newview/llpanelprofilepicks.h b/indra/newview/llpanelprofilepicks.h
index e3f50f5576..5e5d4ff81e 100644
--- a/indra/newview/llpanelprofilepicks.h
+++ b/indra/newview/llpanelprofilepicks.h
@@ -138,6 +138,8 @@ public:
void setParcelID(const LLUUID& parcel_id) override { mParcelId = parcel_id; }
void setErrorStatus(S32 status, const std::string& reason) override {};
+ void addLocationChangedCallbacks();
+
protected:
/**
@@ -200,6 +202,11 @@ public:
void resetDirty() override;
/**
+ * Callback for "Set Location" button click
+ */
+ void onClickSetLocation();
+
+ /**
* Callback for "Save" and "Create" button click
*/
void onClickSave();
@@ -221,6 +228,7 @@ protected:
LLTextureCtrl* mSnapshotCtrl;
LLLineEditor* mPickName;
LLTextEditor* mPickDescription;
+ LLButton* mSetCurrentLocationButton;
LLButton* mSaveButton;
LLButton* mCreateButton;
LLButton* mCancelButton;
@@ -236,7 +244,7 @@ protected:
bool mLocationChanged;
bool mNewPick;
- bool mIsEditing;
+ bool mIsEditing;
void onDescriptionFocusReceived();
};
diff --git a/indra/newview/llphysicsshapebuilderutil.cpp b/indra/newview/llphysicsshapebuilderutil.cpp
index 37534feadc..eb0df1194e 100644
--- a/indra/newview/llphysicsshapebuilderutil.cpp
+++ b/indra/newview/llphysicsshapebuilderutil.cpp
@@ -28,6 +28,26 @@
#include "llphysicsshapebuilderutil.h"
+#include "llmeshrepository.h"
+
+bool LLPhysicsVolumeParams::hasDecomposition() const
+ {
+ if (!isMeshSculpt())
+ {
+ return false;
+ }
+
+ LLUUID mesh_id = getSculptID();
+ if (mesh_id.isNull())
+ {
+ return false;
+ }
+
+ LLModel::Decomposition* decomp = gMeshRepo.getDecomposition(mesh_id);
+
+ return decomp != NULL;
+}
+
/* static */
void LLPhysicsShapeBuilderUtil::determinePhysicsShape( const LLPhysicsVolumeParams& volume_params, const LLVector3& scale, PhysicsShapeSpecification& specOut)
{
@@ -200,19 +220,32 @@ void LLPhysicsShapeBuilderUtil::determinePhysicsShape( const LLPhysicsVolumePara
{
specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX;
}
- else if (volume_params.isMeshSculpt() &&
- // Check overall dimensions, not individual triangles.
- (scale.mV[0] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE ||
- scale.mV[1] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE ||
- scale.mV[2] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE
- ) )
+ else if (volume_params.isMeshSculpt())
{
- // Server distinguishes between user-specified or default convex mesh, vs server's thin-triangle override, but we don't.
- specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX;
+ // Check overall dimensions, not individual triangles.
+ if (scale.mV[0] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE
+ || scale.mV[1] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE
+ || scale.mV[2] < SHAPE_BUILDER_USER_MESH_CONVEXIFICATION_SIZE
+ )
+ {
+ if (volume_params.hasDecomposition())
+ {
+ specOut.mType = PhysicsShapeSpecification::USER_MESH;
+ }
+ else
+ {
+ // Server distinguishes between user-specified or default convex mesh, vs server's thin-triangle override, but we don't.
+ specOut.mType = PhysicsShapeSpecification::PRIM_CONVEX;
+ }
+ }
+ else
+ {
+ specOut.mType = PhysicsShapeSpecification::USER_MESH;
+ }
}
- else if ( volume_params.isSculpt() ) // Is a sculpt of any kind (mesh or legacy)
+ else if ( volume_params.isSculpt() )
{
- specOut.mType = volume_params.isMeshSculpt() ? PhysicsShapeSpecification::USER_MESH : PhysicsShapeSpecification::SCULPT;
+ specOut.mType = PhysicsShapeSpecification::SCULPT;
}
else // Resort to mesh
{
diff --git a/indra/newview/llphysicsshapebuilderutil.h b/indra/newview/llphysicsshapebuilderutil.h
index 33c2d0a8b6..01c173523b 100644
--- a/indra/newview/llphysicsshapebuilderutil.h
+++ b/indra/newview/llphysicsshapebuilderutil.h
@@ -79,6 +79,8 @@ public:
bool shouldForceConvex() const { return mForceConvex; }
+ bool hasDecomposition() const;
+
private:
bool mForceConvex;
};
diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
index 31c6fa35f4..73920d35ad 100644
--- a/indra/newview/llsecapi.h
+++ b/indra/newview/llsecapi.h
@@ -28,7 +28,7 @@
#ifndef LLSECAPI_H
#define LLSECAPI_H
#include <vector>
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include <openssl/x509.h>
#include <ostream>
#include "llpointer.h"
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 6f9de57d2a..34b8535c84 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -549,7 +549,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky()
return skyp;
}
-LLSettingsSky::ptr_t LLSettingsVOSky::buildClone() const
+LLSettingsSky::ptr_t LLSettingsVOSky::buildClone()
{
LLSD settings = cloneSettings();
U32 flags = getFlags();
@@ -684,6 +684,67 @@ void LLSettingsVOSky::updateSettings()
gSky.setMoonScale(getMoonScale());
}
+void draw_color(LLShaderUniforms* shader, const LLColor3& col, S32 shader_key)
+{
+ // always identify as a radiance pass if desaturating irradiance is disabled
+ static LLCachedControl<bool> desaturate_irradiance(gSavedSettings, "RenderDesaturateIrradiance", true);
+
+ LLVector4 vect4(col.mV[0], col.mV[1], col.mV[2]);
+
+ if (desaturate_irradiance && gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass())
+ { // maximize and remove tinting if this is an irradiance map render pass and the parameter feeds into the sky background color
+ auto max_vec = [](LLVector4 col)
+ {
+ LLColor3 color(col);
+ F32 h, s, l;
+ color.calcHSL(&h, &s, &l);
+
+ col.mV[0] = col.mV[1] = col.mV[2] = l;
+ return col;
+ };
+
+ switch (shader_key)
+ {
+ case LLShaderMgr::BLUE_HORIZON:
+ case LLShaderMgr::BLUE_DENSITY:
+ vect4 = max_vec(vect4);
+ break;
+ }
+ }
+
+ //_WARNS("RIDER") << "pushing '" << (*it).first << "' as " << vect4 << LL_ENDL;
+ shader->uniform3fv(shader_key, LLVector3(vect4.mV));
+}
+
+inline void draw_real(LLShaderUniforms* shader, F32 value, S32 shader_key)
+{
+ shader->uniform1f(shader_key, value);
+}
+
+void LLSettingsVOSky::applyToUniforms(void* ptarget)
+{
+ LLShaderUniforms* shader = &((LLShaderUniforms*)ptarget)[LLGLSLShader::SG_ANY];
+
+ draw_color(shader, getAmbientColor(), LLShaderMgr::AMBIENT);
+ draw_color(shader, getBlueDensity(), LLShaderMgr::BLUE_DENSITY);
+ draw_color(shader, getBlueHorizon(), LLShaderMgr::BLUE_HORIZON);
+ draw_real(shader, getHazeDensity(), LLShaderMgr::HAZE_DENSITY);
+ draw_real(shader, getHazeHorizon(), LLShaderMgr::HAZE_HORIZON);
+ draw_real(shader, getDensityMultiplier(), LLShaderMgr::DENSITY_MULTIPLIER);
+ draw_real(shader, getDistanceMultiplier(), LLShaderMgr::DISTANCE_MULTIPLIER);
+ draw_color(shader, getCloudPosDensity2(), LLShaderMgr::CLOUD_POS_DENSITY2);
+ draw_real(shader, getCloudScale(), LLShaderMgr::CLOUD_SCALE);
+ draw_real(shader, getCloudShadow(), LLShaderMgr::CLOUD_SHADOW);
+ draw_real(shader, getCloudVariance(), LLShaderMgr::CLOUD_VARIANCE);
+ draw_color(shader, getGlow(), LLShaderMgr::GLOW);
+ draw_real(shader, getMaxY(), LLShaderMgr::MAX_Y);
+ draw_real(shader, getMoonBrightness(), LLShaderMgr::MOON_BRIGHTNESS);
+ draw_real(shader, getSkyMoistureLevel(), LLShaderMgr::MOISTURE_LEVEL);
+ draw_real(shader, getSkyDropletRadius(), LLShaderMgr::DROPLET_RADIUS);
+ draw_real(shader, getSkyIceLevel(), LLShaderMgr::ICE_LEVEL);
+ draw_real(shader, getReflectionProbeAmbiance(), LLShaderMgr::REFLECTION_PROBE_AMBIANCE);
+}
+
void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
@@ -702,7 +763,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
shader->uniform3fv(LLViewerShaderMgr::LIGHTNORM, light_direction);
// Legacy? SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate")
- LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]);
+ LLVector4 vect_c_p_d1(mCloudPosDensity1.mV[0], mCloudPosDensity1.mV[1], mCloudPosDensity1.mV[2]);
LLVector4 cloud_scroll( LLEnvironment::instance().getCloudScrollDelta() );
// SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll
@@ -935,7 +996,7 @@ LLSettingsWater::ptr_t LLSettingsVOWater::buildDefaultWater()
return waterp;
}
-LLSettingsWater::ptr_t LLSettingsVOWater::buildClone() const
+LLSettingsWater::ptr_t LLSettingsVOWater::buildClone()
{
LLSD settings = cloneSettings();
U32 flags = getFlags();
@@ -974,6 +1035,12 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater)
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
+
+void LLSettingsVOWater::applyToUniforms(void*)
+{
+
+}
+
void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
@@ -1368,7 +1435,7 @@ void LLSettingsVODay::combineIntoDayCycle(LLSettingsDay::ptr_t pday, LLSettingsB
}
-LLSettingsDay::ptr_t LLSettingsVODay::buildClone() const
+LLSettingsDay::ptr_t LLSettingsVODay::buildClone()
{
LLSD settings = cloneSettings();
@@ -1393,10 +1460,10 @@ LLSettingsDay::ptr_t LLSettingsVODay::buildClone() const
return dayp;
}
-LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress() const
+LLSettingsDay::ptr_t LLSettingsVODay::buildDeepCloneAndUncompress()
{
// no need for SETTING_TRACKS or SETTING_FRAMES, so take base LLSD
- LLSD settings = llsd_clone(mSettings);
+ LLSD settings = llsd_clone(getSettings());
U32 flags = getFlags();
LLSettingsDay::ptr_t day_clone = std::make_shared<LLSettingsVODay>(settings);
diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h
index c55b3f82b9..92cb8d0704 100644
--- a/indra/newview/llsettingsvo.h
+++ b/indra/newview/llsettingsvo.h
@@ -94,7 +94,7 @@ public:
static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings, LLSD &messages);
static ptr_t buildDefaultSky();
- virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
+ virtual ptr_t buildClone() SETTINGS_OVERRIDE;
static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages);
@@ -110,6 +110,7 @@ protected:
virtual void updateSettings() override;
+ virtual void applyToUniforms(void*) override;
virtual void applySpecial(void *, bool) override;
virtual parammapping_t getParameterMap() const override;
@@ -128,7 +129,7 @@ public:
static ptr_t buildFromLegacyPreset(const std::string &name, const LLSD &oldsettings, LLSD &messages);
static ptr_t buildDefaultWater();
- virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
+ virtual ptr_t buildClone() SETTINGS_OVERRIDE;
static ptr_t buildFromLegacyPresetFile(const std::string &name, const std::string &path, LLSD &messages);
@@ -138,6 +139,7 @@ protected:
LLSettingsVOWater();
virtual void updateSettings() override;
+ virtual void applyToUniforms(void*) override;
virtual void applySpecial(void *, bool) override;
virtual parammapping_t getParameterMap() const override;
@@ -167,8 +169,8 @@ public:
static ptr_t buildDefaultDayCycle();
static ptr_t buildFromEnvironmentMessage(LLSD settings);
static void buildFromOtherSetting(LLSettingsBase::ptr_t settings, asset_built_fn cb);
- virtual ptr_t buildClone() const SETTINGS_OVERRIDE;
- virtual ptr_t buildDeepCloneAndUncompress() const SETTINGS_OVERRIDE;
+ virtual ptr_t buildClone() SETTINGS_OVERRIDE;
+ virtual ptr_t buildDeepCloneAndUncompress() SETTINGS_OVERRIDE;
static LLSD convertToLegacy(const ptr_t &);
diff --git a/indra/newview/llskinningutil.cpp b/indra/newview/llskinningutil.cpp
index 1c92e06700..cee43f3cff 100644
--- a/indra/newview/llskinningutil.cpp
+++ b/indra/newview/llskinningutil.cpp
@@ -317,19 +317,16 @@ void LLSkinningUtil::initJointNums(LLMeshSkinInfo* skin, LLVOAvatar *avatar)
void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *avatar, LLVolumeFace& vol_face)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
-
if (vol_face.mJointRiggingInfoTab.needsUpdate())
{
S32 num_verts = vol_face.mNumVertices;
S32 num_joints = static_cast<S32>(skin->mJointNames.size());
if (num_verts > 0 && vol_face.mWeights && num_joints > 0)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
initJointNums(const_cast<LLMeshSkinInfo*>(skin), avatar);
if (vol_face.mJointRiggingInfoTab.size()==0)
{
- //std::set<S32> active_joints;
- //S32 active_verts = 0;
vol_face.mJointRiggingInfoTab.resize(LL_CHARACTER_MAX_ANIMATED_JOINTS);
LLJointRiggingInfoTab &rig_info_tab = vol_face.mJointRiggingInfoTab;
for (S32 i=0; i<vol_face.mNumVertices; i++)
@@ -345,35 +342,22 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
F32 w = weights[k];
idx[k] = llclamp((S32) floorf(w), (S32)0, (S32)LL_CHARACTER_MAX_ANIMATED_JOINTS-1);
wght[k] = w - idx[k];
- scale += wght[k];
- }
- if (scale > 0.0f)
- {
- for (U32 k=0; k<4; ++k)
- {
- wght[k] /= scale;
- }
}
+
for (U32 k=0; k<4; ++k)
{
S32 joint_index = idx[k];
- if (wght[k] > 0.0f && num_joints > joint_index)
+ if (wght[k] > 0.2f && num_joints > joint_index)
{
S32 joint_num = skin->mJointNums[joint_index];
if (joint_num >= 0 && joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS)
{
rig_info_tab[joint_num].setIsRiggedTo(true);
- // FIXME could precompute these matMuls.
- const LLMatrix4a& bind_shape = skin->mBindShapeMatrix;
- const LLMatrix4a& inv_bind = skin->mInvBindMatrix[joint_index];
- LLMatrix4a mat;
+ const LLMatrix4a& mat = skin->mBindPoseMatrix[joint_index];
LLVector4a pos_joint_space;
- matMul(bind_shape, inv_bind, mat);
-
mat.affineTransform(pos, pos_joint_space);
- pos_joint_space.mul(wght[k]);
LLVector4a *extents = rig_info_tab[joint_num].getRiggedExtents();
update_min_max(extents[0], extents[1], pos_joint_space);
@@ -381,28 +365,9 @@ void LLSkinningUtil::updateRiggingInfo(const LLMeshSkinInfo* skin, LLVOAvatar *a
}
}
}
- //LL_DEBUGS("RigSpammish") << "built rigging info for vf " << &vol_face
- // << " num_verts " << vol_face.mNumVertices
- // << " active joints " << active_joints.size()
- // << " active verts " << active_verts
- // << LL_ENDL;
vol_face.mJointRiggingInfoTab.setNeedsUpdate(false);
}
}
-
-#if DEBUG_SKINNING
- if (vol_face.mJointRiggingInfoTab.size()!=0)
- {
- LL_DEBUGS("RigSpammish") << "we have rigging info for vf " << &vol_face
- << " num_verts " << vol_face.mNumVertices << LL_ENDL;
- }
- else
- {
- LL_DEBUGS("RigSpammish") << "no rigging info for vf " << &vol_face
- << " num_verts " << vol_face.mNumVertices << LL_ENDL;
- }
-#endif
-
}
}
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp
index 0b73aa493c..ea95d71b27 100644
--- a/indra/newview/llsnapshotlivepreview.cpp
+++ b/indra/newview/llsnapshotlivepreview.cpp
@@ -295,13 +295,20 @@ void LLSnapshotLivePreview::draw()
gGL.pushMatrix();
{
gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom + TOP_PANEL_HEIGHT, 0.f);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.texCoord2f(uv_width, uv_height);
- gGL.vertex2i(rect.getWidth(), rect.getHeight() );
+ gGL.vertex2i(rect.getWidth(), rect.getHeight());
gGL.texCoord2f(0.f, uv_height);
- gGL.vertex2i(0, rect.getHeight() );
+ gGL.vertex2i(0, rect.getHeight());
+
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2i(0, 0);
+
+
+ gGL.texCoord2f(uv_width, uv_height);
+ gGL.vertex2i(rect.getWidth(), rect.getHeight());
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2i(0, 0);
@@ -357,13 +364,18 @@ void LLSnapshotLivePreview::draw()
S32 y2 = gViewerWindow->getWindowHeightScaled() + TOP_PANEL_HEIGHT;
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.color4f(1.f, 1.f, 1.f, 0.f);
gGL.vertex2i(x1, y1);
gGL.vertex2i(x1 + gViewerWindow->getWindowWidthScaled(), y2);
gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY);
gGL.vertex2i(x2 + gViewerWindow->getWindowWidthScaled(), y2);
+
+ gGL.color4f(1.f, 1.f, 1.f, 0.f);
+ gGL.vertex2i(x1, y1);
+ gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY);
+ gGL.vertex2i(x2 + gViewerWindow->getWindowWidthScaled(), y2);
gGL.vertex2i(x2, y1);
gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY);
@@ -371,6 +383,11 @@ void LLSnapshotLivePreview::draw()
gGL.vertex2i(x2 + gViewerWindow->getWindowWidthScaled(), y2);
gGL.color4f(1.f, 1.f, 1.f, 0.f);
gGL.vertex2i(x3 + gViewerWindow->getWindowWidthScaled(), y2);
+
+ gGL.color4f(1.f, 1.f, 1.f, SHINE_OPACITY);
+ gGL.vertex2i(x2, y1);
+ gGL.color4f(1.f, 1.f, 1.f, 0.f);
+ gGL.vertex2i(x3 + gViewerWindow->getWindowWidthScaled(), y2);
gGL.vertex2i(x3, y1);
}
gGL.end();
@@ -406,13 +423,19 @@ void LLSnapshotLivePreview::draw()
LLRect& rect = mImageRect[old_image_index];
gGL.translatef((F32)rect.mLeft, (F32)rect.mBottom - ll_round(getRect().getHeight() * 2.f * (fall_interp * fall_interp)), 0.f);
gGL.rotatef(-45.f * fall_interp, 0.f, 0.f, 1.f);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.texCoord2f(uv_width, uv_height);
- gGL.vertex2i(rect.getWidth(), rect.getHeight() );
+ gGL.vertex2i(rect.getWidth(), rect.getHeight());
gGL.texCoord2f(0.f, uv_height);
- gGL.vertex2i(0, rect.getHeight() );
+ gGL.vertex2i(0, rect.getHeight());
+
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex2i(0, 0);
+
+ gGL.texCoord2f(uv_width, uv_height);
+ gGL.vertex2i(rect.getWidth(), rect.getHeight());
gGL.texCoord2f(0.f, 0.f);
gGL.vertex2i(0, 0);
@@ -667,18 +690,25 @@ bool LLSnapshotLivePreview::onIdle( void* snapshot_preview )
return false;
}
+ static LLCachedControl<bool> auto_snapshot(gSavedSettings, "AutoSnapshot", false);
+ static LLCachedControl<bool> freeze_time(gSavedSettings, "FreezeTime", false);
+ static LLCachedControl<bool> use_freeze_frame(gSavedSettings, "UseFreezeFrame", false);
+ static LLCachedControl<bool> render_ui(gSavedSettings, "RenderUIInSnapshot", false);
+ static LLCachedControl<bool> render_hud(gSavedSettings, "RenderHUDInSnapshot", false);
+ static LLCachedControl<bool> render_no_post(gSavedSettings, "RenderSnapshotNoPost", false);
+
// If we're in freeze-frame and/or auto update mode and camera has moved, update snapshot.
LLVector3 new_camera_pos = LLViewerCamera::getInstance()->getOrigin();
LLQuaternion new_camera_rot = LLViewerCamera::getInstance()->getQuaternion();
if (previewp->mForceUpdateSnapshot ||
- (((gSavedSettings.getBOOL("AutoSnapshot") && LLView::isAvailable(previewp->mViewContainer)) ||
- (gSavedSettings.getBOOL("FreezeTime") && previewp->mAllowFullScreenPreview)) &&
+ (((auto_snapshot && LLView::isAvailable(previewp->mViewContainer)) ||
+ (freeze_time && previewp->mAllowFullScreenPreview)) &&
(new_camera_pos != previewp->mCameraPos || dot(new_camera_rot, previewp->mCameraRot) < 0.995f)))
{
previewp->mCameraPos = new_camera_pos;
previewp->mCameraRot = new_camera_rot;
// request a new snapshot whenever the camera moves, with a time delay
- bool new_snapshot = gSavedSettings.getBOOL("AutoSnapshot") || previewp->mForceUpdateSnapshot;
+ bool new_snapshot = auto_snapshot || previewp->mForceUpdateSnapshot;
LL_DEBUGS("Snapshot") << "camera moved, updating thumbnail" << LL_ENDL;
previewp->updateSnapshot(
new_snapshot, // whether a new snapshot is needed or merely invalidate the existing one
@@ -716,10 +746,10 @@ bool LLSnapshotLivePreview::onIdle( void* snapshot_preview )
previewp->getHeight(),
previewp->mKeepAspectRatio,//gSavedSettings.getBOOL("KeepAspectForSnapshot"),
previewp->getSnapshotType() == LLSnapshotModel::SNAPSHOT_TEXTURE,
- previewp->mAllowRenderUI && gSavedSettings.getBOOL("RenderUIInSnapshot"),
- gSavedSettings.getBOOL("RenderHUDInSnapshot"),
+ previewp->mAllowRenderUI && render_ui,
+ render_hud,
false,
- gSavedSettings.getBOOL("RenderSnapshotNoPost"),
+ render_no_post,
previewp->mSnapshotBufferType,
previewp->getMaxImageSize()))
{
@@ -731,7 +761,7 @@ bool LLSnapshotLivePreview::onIdle( void* snapshot_preview )
previewp->estimateDataSize();
// Full size preview is set: get the decoded image result and save it for animation
- if (gSavedSettings.getBOOL("UseFreezeFrame") && previewp->mAllowFullScreenPreview)
+ if (use_freeze_frame && previewp->mAllowFullScreenPreview)
{
previewp->prepareFreezeFrame();
}
@@ -744,7 +774,7 @@ bool LLSnapshotLivePreview::onIdle( void* snapshot_preview )
previewp->generateThumbnailImage(true) ;
}
previewp->getWindow()->decBusyCount();
- previewp->setVisible(gSavedSettings.getBOOL("UseFreezeFrame") && previewp->mAllowFullScreenPreview); // only show fullscreen preview when in freeze frame mode
+ previewp->setVisible(use_freeze_frame && previewp->mAllowFullScreenPreview); // only show fullscreen preview when in freeze frame mode
previewp->mSnapshotActive = false;
LL_DEBUGS("Snapshot") << "done creating snapshot" << LL_ENDL;
}
@@ -864,7 +894,9 @@ LLPointer<LLImageRaw> LLSnapshotLivePreview::getEncodedImage()
else
{
// Update mFormattedImage if necessary
- getFormattedImage();
+ lock.unlock();
+ getFormattedImage(); // will apply filters to mPreviewImage with a lock
+ lock.lock();
if (getSnapshotFormat() == LLSnapshotModel::SNAPSHOT_FORMAT_BMP)
{
// BMP hack : copy instead of decode otherwise decode will crash.
diff --git a/indra/newview/lltoastalertpanel.h b/indra/newview/lltoastalertpanel.h
index 167a7b2363..c2cdd775f1 100644
--- a/indra/newview/lltoastalertpanel.h
+++ b/indra/newview/lltoastalertpanel.h
@@ -82,14 +82,10 @@ private:
struct ButtonData
{
- ButtonData()
- : mWidth(0)
- {}
-
- LLButton* mButton;
+ LLButton* mButton = nullptr;
std::string mURL;
- U32 mURLExternal;
- S32 mWidth;
+ U32 mURLExternal = 0;
+ S32 mWidth = 0;
};
std::vector<ButtonData> mButtonData;
diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp
index 24cfca5eee..8ce9a8b632 100644
--- a/indra/newview/lltoolmorph.cpp
+++ b/indra/newview/lltoolmorph.cpp
@@ -285,7 +285,7 @@ void LLVisualParamHint::draw(F32 alpha)
gGL.color4f(1.f, 1.f, 1.f, alpha);
LLGLSUIDefault gls_ui;
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.texCoord2i(0, 1);
gGL.vertex2i(0, mFullHeight);
@@ -293,6 +293,11 @@ void LLVisualParamHint::draw(F32 alpha)
gGL.vertex2i(0, 0);
gGL.texCoord2i(1, 0);
gGL.vertex2i(mFullWidth, 0);
+
+ gGL.texCoord2i(0, 1);
+ gGL.vertex2i(0, mFullHeight);
+ gGL.texCoord2i(1, 0);
+ gGL.vertex2i(mFullWidth, 0);
gGL.texCoord2i(1, 1);
gGL.vertex2i(mFullWidth, mFullHeight);
}
diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp
index 5ccda7d4eb..3bd459f5b0 100644
--- a/indra/newview/lltoolselect.cpp
+++ b/indra/newview/lltoolselect.cpp
@@ -55,17 +55,17 @@ LLToolSelect::LLToolSelect( LLToolComposite* composite )
: LLTool( std::string("Select"), composite ),
mIgnoreGroup( false )
{
- }
+}
// True if you selected an object.
bool LLToolSelect::handleMouseDown(S32 x, S32 y, MASK mask)
{
// do immediate pick query
bool pick_rigged = false; //gSavedSettings.getBOOL("AnimatedObjectsAllowLeftClick");
- bool pick_transparent = gSavedSettings.getBOOL("SelectInvisibleObjects");
- bool pick_reflection_probe = gSavedSettings.getBOOL("SelectReflectionProbes");
+ static LLCachedControl<bool> select_invisible_objects(gSavedSettings, "SelectInvisibleObjects");
+ static LLCachedControl<bool> select_reflection_probes(gSavedSettings, "SelectReflectionProbes");
- mPick = gViewerWindow->pickImmediate(x, y, pick_transparent, pick_rigged, false, true, pick_reflection_probe);
+ mPick = gViewerWindow->pickImmediate(x, y, select_invisible_objects, pick_rigged, false, true, select_reflection_probes);
// Pass mousedown to agent
LLTool::handleMouseDown(x, y, mask);
@@ -73,7 +73,6 @@ bool LLToolSelect::handleMouseDown(S32 x, S32 y, MASK mask)
return mPick.getObject().notNull();
}
-
// static
LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pick, bool ignore_group, bool temp_select, bool select_root)
{
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index f722d0bd1d..6278832765 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -1625,7 +1625,8 @@ void render_ui_3d()
gGL.color4f(1, 1, 1, 1);
// Coordinate axes
- if (gSavedSettings.getBOOL("ShowAxes"))
+ LLCachedControl<bool> show_axes(gSavedSettings, "ShowAxes");
+ if (show_axes())
{
draw_axes();
}
diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp
index e733dafcae..511fac9788 100644
--- a/indra/newview/llviewerjointattachment.cpp
+++ b/indra/newview/llviewerjointattachment.cpp
@@ -86,13 +86,17 @@ U32 LLViewerJointAttachment::drawShape( F32 pixelArea, bool first_pass, bool is_
LLGLDisable cull_face(GL_CULL_FACE);
gGL.color4f(1.f, 1.f, 1.f, 1.f);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
{
gGL.vertex3f(-0.1f, 0.1f, 0.f);
gGL.vertex3f(-0.1f, -0.1f, 0.f);
gGL.vertex3f(0.1f, -0.1f, 0.f);
+
+ gGL.vertex3f(-0.1f, 0.1f, 0.f);
+ gGL.vertex3f(0.1f, -0.1f, 0.f);
gGL.vertex3f(0.1f, 0.1f, 0.f);
- }gGL.end();
+ }
+ gGL.end();
}
return 0;
}
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp
index f0567b18c4..da7ad71336 100644
--- a/indra/newview/llviewerjointmesh.cpp
+++ b/indra/newview/llviewerjointmesh.cpp
@@ -407,10 +407,16 @@ void LLViewerJointMesh::updateFaceData(LLFace *face, F32 pixel_area, bool damp_w
F32* vw = (F32*) vertex_weightsp.get();
F32* cw = (F32*) clothing_weightsp.get();
- S32 tc_size = (num_verts*2*sizeof(F32)+0xF) & ~0xF;
- LLVector4a::memcpyNonAliased16(tc, (F32*) mMesh->getTexCoords(), tc_size);
- S32 vw_size = (num_verts*sizeof(F32)+0xF) & ~0xF;
- LLVector4a::memcpyNonAliased16(vw, (F32*) mMesh->getWeights(), vw_size);
+ //S32 tc_size = (num_verts*2*sizeof(F32)+0xF) & ~0xF;
+ //LLVector4a::memcpyNonAliased16(tc, (F32*) mMesh->getTexCoords(), tc_size);
+ //S32 vw_size = (num_verts*sizeof(F32)+0xF) & ~0xF;
+ //LLVector4a::memcpyNonAliased16(vw, (F32*) mMesh->getWeights(), vw_size);
+
+ // Both allocated in LLPolyMeshSharedData::allocateVertexData(unsigned int)
+
+ memcpy(tc, mMesh->getTexCoords(), num_verts*2*sizeof(F32) );
+ memcpy(vw, mMesh->getWeights(), num_verts*sizeof(F32) );
+
LLVector4a::memcpyNonAliased16(cw, (F32*) mMesh->getClothingWeights(), num_verts*4*sizeof(F32));
}
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 1c8f1a32b9..92db598410 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -688,10 +688,10 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
static LLCachedControl<bool> inworld_media_enabled(gSavedSettings, "AudioStreamingMedia", true);
static LLCachedControl<bool> inworld_audio_enabled(gSavedSettings, "AudioStreamingMusic", true);
- U32 max_instances = gSavedSettings.getU32("PluginInstancesTotal");
- U32 max_normal = gSavedSettings.getU32("PluginInstancesNormal");
- U32 max_low = gSavedSettings.getU32("PluginInstancesLow");
- F32 max_cpu = gSavedSettings.getF32("PluginInstancesCPULimit");
+ static LLCachedControl<U32> max_instances(gSavedSettings, "PluginInstancesTotal", 8);
+ static LLCachedControl<U32> max_normal(gSavedSettings, "PluginInstancesNormal", 2);
+ static LLCachedControl<U32> max_low(gSavedSettings, "PluginInstancesLow", 4);
+ static LLCachedControl<F32> max_cpu(gSavedSettings, "PluginInstancesCPULimit", 0.9);
// Setting max_cpu to 0.0 disables CPU usage checking.
bool check_cpu_usage = (max_cpu != 0.0f);
@@ -829,7 +829,8 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
}
else
{
- if(gAudiop && LLViewerMedia::hasParcelAudio() && restore_parcel_audio && gSavedSettings.getBOOL("MediaTentativeAutoPlay"))
+ static LLCachedControl<bool> auto_play(gSavedSettings, "MediaTentativeAutoPlay", true);
+ if(gAudiop && LLViewerMedia::hasParcelAudio() && restore_parcel_audio && auto_play())
{
LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLViewerMedia::getParcelAudioURL());
restore_parcel_audio = false;
@@ -880,7 +881,8 @@ void LLViewerMedia::updateMedia(void *dummy_arg)
}
}
- if(gSavedSettings.getBOOL("MediaPerformanceManagerDebug"))
+ static LLCachedControl<bool> perf_debug(gSavedSettings, "MediaPerformanceManagerDebug", false);
+ if(perf_debug())
{
// Give impls the same ordering as the priority list
// they're already in the right order for this.
@@ -1728,8 +1730,6 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
std::string user_data_path_cache = gDirUtilp->getCacheDir(false);
user_data_path_cache += gDirUtilp->getDirDelimiter();
- std::string user_data_path_cef_log = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "cef_log.txt");
-
// See if the plugin executable exists
llstat s;
if(LLFile::stat(launcher_name, &s))
@@ -1738,14 +1738,13 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
}
else if(LLFile::stat(plugin_name, &s))
{
-#if !LL_LINUX
LL_WARNS_ONCE("Media") << "Couldn't find plugin at " << plugin_name << LL_ENDL;
-#endif
}
else
{
media_source = new LLPluginClassMedia(owner);
media_source->setSize(default_width, default_height);
+ std::string user_data_path_cef_log = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "cef.log");
media_source->setUserDataPath(user_data_path_cache, gDirUtilp->getUserName(), user_data_path_cef_log);
media_source->setLanguageCode(LLUI::getLanguage());
media_source->setZoomFactor(zoom_factor);
@@ -1771,6 +1770,11 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
bool media_plugin_debugging_enabled = gSavedSettings.getBOOL("MediaPluginDebugging");
media_source->enableMediaPluginDebugging( media_plugin_debugging_enabled || clean_browser);
+#if LL_LINUX
+ bool media_plugin_pipewire_volume_catcher = gSavedSettings.getBOOL("MediaPluginPipeWireVolumeCatcher");
+ media_source->enablePipeWireVolumeCatcher( media_plugin_pipewire_volume_catcher );
+#endif
+
// need to set agent string here before instance created
media_source->setBrowserUserAgent(LLViewerMedia::getInstance()->getCurrentUserAgent());
@@ -1792,9 +1796,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
}
}
}
-#if !LL_LINUX
LL_WARNS_ONCE("Plugin") << "plugin initialization failed for mime type: " << media_type << LL_ENDL;
-#endif
if(gAgent.isInitialized())
{
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index a7593b953a..a37e15f8da 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -3153,14 +3153,9 @@ void process_crossed_region(LLMessageSystem* msg, void**)
}
-
-// Sends avatar and camera information to simulator.
-// Sent roughly once per frame, or 20 times per second, whichever is less often
-
-const F32 THRESHOLD_HEAD_ROT_QDOT = 0.9997f; // ~= 2.5 degrees -- if its less than this we need to update head_rot
-const F32 MAX_HEAD_ROT_QDOT = 0.99999f; // ~= 0.5 degrees -- if its greater than this then no need to update head_rot
- // between these values we delay the updates (but no more than one second)
-
+// sends an AgentUpdate message to the server... or not:
+// only when force_send is 'true' OR
+// something changed AND the update is not being throttled
void send_agent_update(bool force_send, bool send_reliable)
{
LL_PROFILE_ZONE_SCOPED;
@@ -3168,72 +3163,46 @@ void send_agent_update(bool force_send, bool send_reliable)
if (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE)
{
- // We don't care if they want to send an agent update, they're not allowed to until the simulator
- // that's the target is ready to receive them (after avatar_init_complete is received)
+ // We don't care if they want to send an agent update, they're not allowed
+ // until the target simulator is ready to receive them
+ // (e.g. after avatar_init_complete is received)
return;
}
- // We have already requested to log out. Don't send agent updates.
- if(LLAppViewer::instance()->logoutRequestSent())
+ if (LLAppViewer::instance()->logoutRequestSent())
{
+ // We have already requested to log out. Don't send agent updates.
return;
}
- // no region to send update to
- if(gAgent.getRegion() == NULL)
+ if (gAgent.getRegion() == nullptr || gDisconnected)
{
+ // no region to send update to
return;
}
- const F32 TRANSLATE_THRESHOLD = 0.01f;
-
- // NOTA BENE: This is (intentionally?) using the small angle sine approximation to test for rotation
- // Plus, there is an extra 0.5 in the mix since the perpendicular between last_camera_at and getAtAxis() bisects cam_rot_change
- // Thus, we're actually testing against 0.2 degrees
- const F32 ROTATION_THRESHOLD = 0.1f * 2.f*F_PI/360.f; // Rotation thresh 0.2 deg, see note above
-
- const U8 DUP_MSGS = 1; // HACK! number of times to repeat data on motionless agent
-
- // Store data on last sent update so that if no changes, no send
- static LLVector3 last_camera_pos_agent,
- last_camera_at,
- last_camera_left,
- last_camera_up;
-
- static LLVector3 cam_center_chg,
- cam_rot_chg;
-
- static LLQuaternion last_head_rot;
- static U32 last_control_flags = 0;
- static U8 last_render_state;
- static U8 duplicate_count = 0;
- static F32 head_rot_chg = 1.0;
- static U8 last_flags;
-
- LLMessageSystem *msg = gMessageSystem;
- LLVector3 camera_pos_agent; // local to avatar's region
- U8 render_state;
-
- LLQuaternion body_rotation = gAgent.getFrameAgent().getQuaternion();
- LLQuaternion head_rotation = gAgent.getHeadRotation();
-
- camera_pos_agent = gAgentCamera.getCameraPositionAgent();
-
- render_state = gAgent.getRenderState();
-
- U32 control_flag_change = 0;
- U8 flag_change = 0;
+ static F64 last_send_time = 0.0;
+ static U32 last_control_flags = 0;
+ static U8 last_render_state = 0;
+ static U8 last_flags = AU_FLAGS_NONE;
+ static LLQuaternion last_body_rot,
+ last_head_rot;
+ static LLVector3 last_camera_pos_agent,
+ last_camera_at;
- cam_center_chg = last_camera_pos_agent - camera_pos_agent;
- cam_rot_chg = last_camera_at - LLViewerCamera::getInstance()->getAtAxis();
+ // compute sec_since_last_send
+ constexpr F64 MAX_AGENT_UPDATES_PER_SECOND = 125.0; // Value derived experimentally to avoid Input Delays with latest PBR-Capable Viewers when viewer FPS is highly volatile.
+ constexpr F64 MIN_AGENT_UPDATES_PER_SECOND = 1.0; // keep-alive rate
+ constexpr F64 MIN_AGENT_UPDATE_PERIOD = 1.0 / MAX_AGENT_UPDATES_PER_SECOND;
+ constexpr F64 MAX_AGENT_UPDATE_PERIOD = 1.0 / MIN_AGENT_UPDATES_PER_SECOND;
+ F64 now = LLFrameTimer::getTotalSeconds();
+ F64 sec_since_last_send = now - last_send_time;
// If a modifier key is held down, turn off
// LBUTTON and ML_LBUTTON so that using the camera (alt-key) doesn't
// trigger a control event.
U32 control_flags = gAgent.getControlFlags();
-
- MASK key_mask = gKeyboard->currentMask(true);
-
+ MASK key_mask = gKeyboard->currentMask(true);
if (key_mask & MASK_ALT || key_mask & MASK_CONTROL)
{
control_flags &= ~( AGENT_CONTROL_LBUTTON_DOWN |
@@ -3242,7 +3211,22 @@ void send_agent_update(bool force_send, bool send_reliable)
AGENT_CONTROL_ML_LBUTTON_UP ;
}
- control_flag_change = last_control_flags ^ control_flags;
+ // any change in control_flags should be sent ASAP, so we fold that into force_send
+ force_send = force_send || (control_flags != last_control_flags);
+
+ if (! force_send && sec_since_last_send < MIN_AGENT_UPDATE_PERIOD)
+ {
+ // throttle less-important AgentUpdates
+ return;
+ }
+
+ bool send_update = force_send || sec_since_last_send > MAX_AGENT_UPDATE_PERIOD;
+
+ LLVector3 camera_pos_agent = gAgentCamera.getCameraPositionAgent(); // local to avatar's region
+ LLVector3 camera_at = LLViewerCamera::getInstance()->getAtAxis();
+ LLQuaternion body_rotation = gAgent.getFrameAgent().getQuaternion();
+ LLQuaternion head_rotation = gAgent.getHeadRotation();
+ U8 render_state = gAgent.getRenderState();
U8 flags = AU_FLAGS_NONE;
if (gAgent.isGroupTitleHidden())
@@ -3254,159 +3238,140 @@ void send_agent_update(bool force_send, bool send_reliable)
flags |= AU_FLAGS_CLIENT_AUTOPILOT;
}
- flag_change = last_flags ^ flags;
-
- head_rot_chg = dot(last_head_rot, head_rotation);
-
- //static S32 msg_number = 0; // Used for diagnostic log messages
-
- if (force_send ||
- (cam_center_chg.magVec() > TRANSLATE_THRESHOLD) ||
- (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT) ||
- (last_render_state != render_state) ||
- (cam_rot_chg.magVec() > ROTATION_THRESHOLD) ||
- control_flag_change != 0 ||
- flag_change != 0)
+ if (!send_update)
{
- /* Diagnotics to show why we send the AgentUpdate message. Also un-commment the msg_number code above and below this block
- msg_number += 1;
- if (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT)
- {
- //LL_INFOS("Messaging") << "head rot " << head_rotation << LL_ENDL;
- LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", head_rot_chg " << head_rot_chg << LL_ENDL;
- }
- if (cam_rot_chg.magVec() > ROTATION_THRESHOLD)
+ // check to see if anything changed
+ // use a do-while-false to provide easy way to break out as soon as we find something changed
+ do
{
- LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", cam rot " << cam_rot_chg.magVec() << LL_ENDL;
- }
- if (cam_center_chg.magVec() > TRANSLATE_THRESHOLD)
- {
- LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", cam center " << cam_center_chg.magVec() << LL_ENDL;
- }
-// if (drag_delta_chg.magVec() > TRANSLATE_THRESHOLD)
-// {
-// LL_INFOS("Messaging") << "drag delta " << drag_delta_chg.magVec() << LL_ENDL;
-// }
- if (control_flag_change)
- {
- LL_INFOS("Messaging") << "msg " << msg_number << ", frame " << LLFrameTimer::getFrameCount() << ", dcf = " << control_flag_change << LL_ENDL;
- }
-*/
-
- duplicate_count = 0;
- }
- else
- {
- duplicate_count++;
+ // start with the easy evaluations and progress to more complicated
- if (head_rot_chg < MAX_HEAD_ROT_QDOT && duplicate_count < AGENT_UPDATES_PER_SECOND)
- {
- // The head_rotation is sent for updating things like attached guns.
- // We only trigger a new update when head_rotation deviates beyond
- // some threshold from the last update, however this can break fine
- // adjustments when trying to aim an attached gun, so what we do here
- // (where we would normally skip sending an update when nothing has changed)
- // is gradually reduce the threshold to allow a better update to
- // eventually get sent... should update to within 0.5 degrees in less
- // than a second.
- if (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT + (MAX_HEAD_ROT_QDOT - THRESHOLD_HEAD_ROT_QDOT) * duplicate_count / AGENT_UPDATES_PER_SECOND)
+ // check render_state
+ if (last_render_state != render_state)
{
- duplicate_count = 0;
+ send_update = true;
+ break;
}
- else
+
+ // check flags
+ if (last_flags != flags)
{
- return;
+ send_update = true;
+ break;
}
- }
- else
- {
- return;
- }
- }
- if (duplicate_count < DUP_MSGS && !gDisconnected)
- {
- /* More diagnostics to count AgentUpdate messages
- static S32 update_sec = 0;
- static S32 update_count = 0;
- static S32 max_update_count = 0;
- S32 cur_sec = lltrunc( LLTimer::getTotalSeconds() );
- update_count += 1;
- if (cur_sec != update_sec)
- {
- if (update_sec != 0)
+ // check translation
+ constexpr F32 TRANSLATE_THRESHOLD = 0.01f;
+ if ((last_camera_pos_agent - camera_pos_agent).magVec() > TRANSLATE_THRESHOLD)
{
- update_sec = cur_sec;
- //msg_number = 0;
- max_update_count = llmax(max_update_count, update_count);
- LL_INFOS() << "Sent " << update_count << " AgentUpdate messages per second, max is " << max_update_count << LL_ENDL;
+ send_update = true;
+ break;
}
- update_sec = cur_sec;
- update_count = 0;
- }
- */
- // Build the message
- msg->newMessageFast(_PREHASH_AgentUpdate);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addQuatFast(_PREHASH_BodyRotation, body_rotation);
- msg->addQuatFast(_PREHASH_HeadRotation, head_rotation);
- msg->addU8Fast(_PREHASH_State, render_state);
- msg->addU8Fast(_PREHASH_Flags, flags);
-
-// if (camera_pos_agent.mV[VY] > 255.f)
-// {
-// LL_INFOS("Messaging") << "Sending camera center " << camera_pos_agent << LL_ENDL;
-// }
-
- msg->addVector3Fast(_PREHASH_CameraCenter, camera_pos_agent);
- msg->addVector3Fast(_PREHASH_CameraAtAxis, LLViewerCamera::getInstance()->getAtAxis());
- msg->addVector3Fast(_PREHASH_CameraLeftAxis, LLViewerCamera::getInstance()->getLeftAxis());
- msg->addVector3Fast(_PREHASH_CameraUpAxis, LLViewerCamera::getInstance()->getUpAxis());
- msg->addF32Fast(_PREHASH_Far, gAgentCamera.mDrawDistance);
+ // check camera rotation
+ // Note: we are using the sine small angle approximation trick here
+ constexpr F32 RADIANS_PER_DEGREE = F_PI / 360.f;
+ constexpr F32 CAMERA_AT_THRESHOLD = 0.2f * RADIANS_PER_DEGREE;
+ if ((last_camera_at - camera_at).magVec() > CAMERA_AT_THRESHOLD)
+ {
+ send_update = true;
+ break;
+ }
- msg->addU32Fast(_PREHASH_ControlFlags, control_flags);
+ // check head rotation
+ constexpr F64 MIN_HEAD_ROT_QDOT = 0.9997; // ~= 2.5 degrees -- if its less than this we need to update head_rot
+ constexpr F64 MAX_HEAD_ROT_QDOT = 0.99999; // ~= 0.5 degrees -- if its greater than this then we consider it close enough
- if (gDebugClicks)
- {
- if (control_flags & AGENT_CONTROL_LBUTTON_DOWN)
+ if (fabs((F64)(dot(last_body_rot, body_rotation))) < MIN_HEAD_ROT_QDOT)
{
- LL_INFOS("Messaging") << "AgentUpdate left button down" << LL_ENDL;
+ send_update = true;
+ break;
}
- if (control_flags & AGENT_CONTROL_LBUTTON_UP)
+ F64 head_rot_qdot = fabs((F64)(dot(last_head_rot, head_rotation)));
+ if (head_rot_qdot > MAX_HEAD_ROT_QDOT)
{
- LL_INFOS("Messaging") << "AgentUpdate left button up" << LL_ENDL;
+ // close enough
+ return;
}
- }
+ else if (head_rot_qdot < MIN_HEAD_ROT_QDOT)
+ {
+ // way off
+ send_update = true;
+ break;
+ }
+
+ // Finally, if we get here then head_rot_qdot is somewhere between MIN_ and MAX_HEAD_ROT_QDOT
- gAgent.enableControlFlagReset();
+ // The head_rotation is sent for updating things like attached guns.
+ // We only trigger a new update when head_rotation deviates beyond
+ // some threshold from the last update, however this can break fine
+ // adjustments when trying to aim an attached gun, so what we do here
+ // (where we would normally skip sending an update when nothing has changed)
+ // is linearly increase the min threshold until an update is sent.
+ // Min threshold should update to MAX_HEAD_ROT_QDOT within THRESHOLD_GROWTH_PERIOD.
+ constexpr F64 THRESHOLD_GROWTH_PERIOD = 0.5;
+ constexpr F64 threshold_growth_per_sec = (MAX_HEAD_ROT_QDOT - MIN_HEAD_ROT_QDOT) / THRESHOLD_GROWTH_PERIOD;
+ send_update = head_rot_qdot < MIN_HEAD_ROT_QDOT + sec_since_last_send * threshold_growth_per_sec;
+ } while (false);
+ }
+
+ if (!send_update)
+ {
+ return;
+ }
+
+ // Build the message
+ LLMessageSystem* msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_AgentUpdate);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->addQuatFast(_PREHASH_BodyRotation, body_rotation);
+ msg->addQuatFast(_PREHASH_HeadRotation, head_rotation);
+ msg->addU8Fast(_PREHASH_State, render_state);
+ msg->addU8Fast(_PREHASH_Flags, flags);
- if (!send_reliable)
+ msg->addVector3Fast(_PREHASH_CameraCenter, camera_pos_agent);
+ msg->addVector3Fast(_PREHASH_CameraAtAxis, camera_at);
+ msg->addVector3Fast(_PREHASH_CameraLeftAxis, LLViewerCamera::getInstance()->getLeftAxis());
+ msg->addVector3Fast(_PREHASH_CameraUpAxis, LLViewerCamera::getInstance()->getUpAxis());
+ msg->addF32Fast(_PREHASH_Far, gAgentCamera.mDrawDistance);
+
+ msg->addU32Fast(_PREHASH_ControlFlags, control_flags);
+
+ if (gDebugClicks)
+ {
+ if (control_flags & AGENT_CONTROL_LBUTTON_DOWN)
{
- gAgent.sendMessage();
+ LL_INFOS("Messaging") << "AgentUpdate left button down" << LL_ENDL;
}
- else
+
+ if (control_flags & AGENT_CONTROL_LBUTTON_UP)
{
- gAgent.sendReliableMessage();
+ LL_INFOS("Messaging") << "AgentUpdate left button up" << LL_ENDL;
}
+ }
-// LL_DEBUGS("Messaging") << "agent " << avatar_pos_agent << " cam " << camera_pos_agent << LL_ENDL;
-
- // Copy the old data
- last_head_rot = head_rotation;
- last_render_state = render_state;
- last_camera_pos_agent = camera_pos_agent;
- last_camera_at = LLViewerCamera::getInstance()->getAtAxis();
- last_camera_left = LLViewerCamera::getInstance()->getLeftAxis();
- last_camera_up = LLViewerCamera::getInstance()->getUpAxis();
- last_control_flags = control_flags;
- last_flags = flags;
+ if (send_reliable)
+ {
+ gAgent.sendReliableMessage();
+ }
+ else
+ {
+ gAgent.sendMessage();
}
-}
+ // remember last update data
+ last_send_time = now;
+ last_control_flags = control_flags;
+ last_render_state = render_state;
+ last_flags = flags;
+ last_body_rot = body_rotation;
+ last_head_rot = head_rotation;
+ last_camera_pos_agent = camera_pos_agent;
+ last_camera_at = camera_at;
+}
// sounds can arrive before objects, store them for a short time
// Note: this is a workaround for MAINT-4743, real fix would be to make
@@ -6788,7 +6753,8 @@ void onCovenantLoadComplete(const LLUUID& asset_uuid,
{
LL_DEBUGS("Messaging") << "onCovenantLoadComplete()" << LL_ENDL;
std::string covenant_text;
- if(0 == status)
+ std::unique_ptr<LLViewerTextEditor> editorp;
+ if (0 == status)
{
LLFileSystem file(asset_uuid, type, LLFileSystem::READ);
@@ -6809,13 +6775,13 @@ void onCovenantLoadComplete(const LLUUID& asset_uuid,
{
LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL;
covenant_text = "Problem importing estate covenant.";
+ delete editor;
}
else
{
// Version 0 (just text, doesn't include version number)
- covenant_text = editor->getText();
+ editorp.reset(editor); // Use covenant from editorp;
}
- delete editor;
}
else
{
@@ -6841,17 +6807,32 @@ void onCovenantLoadComplete(const LLUUID& asset_uuid,
LL_WARNS("Messaging") << "Problem loading notecard: " << status << LL_ENDL;
}
- LLPanelEstateCovenant::updateCovenantText(covenant_text, asset_uuid);
- LLPanelLandCovenant::updateCovenantText(covenant_text);
- LLFloaterBuyLand::updateCovenantText(covenant_text, asset_uuid);
- LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel<LLPanelPlaceProfile>("places", "panel_place_profile");
- if (panel)
+ if (editorp)
{
- panel->updateCovenantText(covenant_text);
+ LLPanelEstateCovenant::updateCovenant(editorp.get(), asset_uuid);
+ LLPanelLandCovenant::updateCovenant(editorp.get());
+ LLFloaterBuyLand::updateCovenant(editorp.get(), asset_uuid);
+ }
+ else
+ {
+ LLPanelEstateCovenant::updateCovenantText(covenant_text, asset_uuid);
+ LLPanelLandCovenant::updateCovenantText(covenant_text);
+ LLFloaterBuyLand::updateCovenantText(covenant_text, asset_uuid);
}
-}
+ if (LLPanelPlaceProfile* panel = LLFloaterSidePanelContainer::getPanel<LLPanelPlaceProfile>("places", "panel_place_profile"))
+ {
+ if (editorp)
+ {
+ panel->updateCovenant(editorp.get());
+ }
+ else
+ {
+ panel->updateCovenantText(covenant_text);
+ }
+ }
+}
void process_feature_disabled_message(LLMessageSystem* msg, void**)
{
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index e36a03a749..41b2c4b44b 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -2917,24 +2917,33 @@ void LLViewerObject::fetchInventoryFromServer()
delete mInventory;
mInventory = NULL;
- // Results in processTaskInv
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_RequestTaskInventory);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_InventoryData);
- msg->addU32Fast(_PREHASH_LocalID, mLocalID);
- msg->sendReliable(mRegionp->getHost());
-
// This will get reset by doInventoryCallback or processTaskInv
mInvRequestState = INVENTORY_REQUEST_PENDING;
+
+ if (mRegionp && !mRegionp->getCapability("RequestTaskInventory").empty())
+ {
+ LLCoros::instance().launch("LLViewerObject::fetchInventoryFromCapCoro()",
+ boost::bind(&LLViewerObject::fetchInventoryFromCapCoro, mID));
+ }
+ else
+ {
+ LL_WARNS() << "Using old task inventory path!" << LL_ENDL;
+ // Results in processTaskInv
+ LLMessageSystem *msg = gMessageSystem;
+ msg->newMessageFast(_PREHASH_RequestTaskInventory);
+ msg->nextBlockFast(_PREHASH_AgentData);
+ msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
+ msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
+ msg->nextBlockFast(_PREHASH_InventoryData);
+ msg->addU32Fast(_PREHASH_LocalID, mLocalID);
+ msg->sendReliable(mRegionp->getHost());
+ }
}
}
void LLViewerObject::fetchInventoryDelayed(const F64 &time_seconds)
{
- // unless already waiting, drop previous request and shedule an update
+ // unless already waiting, drop previous request and schedule an update
if (mInvRequestState != INVENTORY_REQUEST_WAIT)
{
if (mInvRequestXFerId != 0)
@@ -2965,6 +2974,80 @@ void LLViewerObject::fetchInventoryDelayedCoro(const LLUUID task_inv, const F64
}
}
+//static
+void LLViewerObject::fetchInventoryFromCapCoro(const LLUUID task_inv)
+{
+ LLViewerObject *obj = gObjectList.findObject(task_inv);
+ if (obj)
+ {
+ LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
+ LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
+ httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("TaskInventoryRequest", httpPolicy));
+ LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
+ std::string url = obj->mRegionp->getCapability("RequestTaskInventory") + "?task_id=" + obj->mID.asString();
+ // If we already have a copy of the inventory then add it so the server won't re-send something we already have.
+ // We expect this case to crop up in the case of failed inventory mutations, but it might happen otherwise as well.
+ if (obj->mInventorySerialNum && obj->mInventory)
+ url += "&inventory_serial=" + std::to_string(obj->mInventorySerialNum);
+
+ obj->mInvRequestState = INVENTORY_XFER;
+ LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
+
+ LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
+ LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
+
+ // Object may have gone away while we were suspended, double-check that it still exists
+ obj = gObjectList.findObject(task_inv);
+ if (!obj)
+ {
+ LL_WARNS() << "Object " << task_inv << " went away while fetching inventory, dropping result" << LL_ENDL;
+ return;
+ }
+
+ bool potentially_stale = false;
+ if (status)
+ {
+ // Dealing with inventory serials is kind of funky. They're monotonically increasing and 16 bits,
+ // so we expect them to overflow, but we can use inv serial < expected serial as a signal that we may
+ // have mutated the task inventory since we kicked off the request, and those mutations may have not
+ // been taken into account yet. Of course, those mutations may have actually failed which would result
+ // in the inv serial never increasing.
+ //
+ // When we detect this case, set the expected inv serial to the inventory serial we actually received
+ // and kick off a re-request after a slight delay.
+ S16 serial = (S16)result["inventory_serial"].asInteger();
+ potentially_stale = serial < obj->mExpectedInventorySerialNum;
+ LL_INFOS() << "Inventory loaded for " << task_inv << LL_ENDL;
+ obj->mInventorySerialNum = serial;
+ obj->mExpectedInventorySerialNum = serial;
+ obj->loadTaskInvLLSD(result);
+ }
+ else if (status.getType() == 304)
+ {
+ LL_INFOS() << "Inventory wasn't changed on server!" << LL_ENDL;
+ obj->mInvRequestState = INVENTORY_REQUEST_STOPPED;
+ // Even though it wasn't necessary to send a response, we still may have mutated
+ // the inventory since we kicked off the request, check for that case.
+ potentially_stale = obj->mInventorySerialNum < obj->mExpectedInventorySerialNum;
+ // Set this to what we already have so that we don't re-request a second time.
+ obj->mExpectedInventorySerialNum = obj->mInventorySerialNum;
+ }
+ else
+ {
+ // Not sure that there's anything sensible we can do to recover here, retrying in a loop would be bad.
+ LL_WARNS() << "Error status while requesting task inventory: " << status.toString() << LL_ENDL;
+ obj->mInvRequestState = INVENTORY_REQUEST_STOPPED;
+ }
+
+ if (potentially_stale)
+ {
+ // Stale? I guess we can use what we got for now, but we'll have to re-request
+ LL_WARNS() << "Stale inv_serial? Re-requesting." << LL_ENDL;
+ obj->fetchInventoryDelayed(INVENTORY_UPDATE_WAIT_TIME_OUTDATED);
+ }
+ }
+}
+
LLControlAvatar *LLViewerObject::getControlAvatar()
{
return getRootEdit()->mControlAvatar.get();
@@ -3140,6 +3223,20 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data)
S16 serial = 0;
msg->getS16Fast(_PREHASH_InventoryData, _PREHASH_Serial, serial);
+ if (object->mRegionp && !object->mRegionp->getCapability("RequestTaskInventory").empty())
+ {
+ // It seems that simulator may ask us to re-download the task inventory if an update to the inventory
+ // happened out-of-band while we had the object selected (like if a script is saved.)
+ //
+ // If we're meant to use the HTTP capability, ignore the contents of the UDP message and fetch the
+ // inventory via the CAP so that we don't flow down the UDP inventory request path unconditionally here.
+ // We shouldn't need to wait, as any updates should already be ready to fetch by this point.
+ LL_INFOS() << "Handling unsolicited ReplyTaskInventory for " << task_id << LL_ENDL;
+ object->mExpectedInventorySerialNum = serial;
+ object->fetchInventoryFromServer();
+ return;
+ }
+
if (serial == object->mInventorySerialNum
&& serial < object->mExpectedInventorySerialNum)
{
@@ -3347,6 +3444,47 @@ bool LLViewerObject::loadTaskInvFile(const std::string& filename)
return true;
}
+void LLViewerObject::loadTaskInvLLSD(const LLSD& inv_result)
+{
+ if (inv_result.has("contents"))
+ {
+ if(mInventory)
+ {
+ mInventory->clear(); // will deref and delete it
+ }
+ else
+ {
+ mInventory = new LLInventoryObject::object_list_t;
+ }
+
+ // Synthesize the "Contents" category, the viewer expects it, but it isn't sent.
+ LLPointer<LLInventoryObject> inv = new LLInventoryObject(mID, LLUUID::null, LLAssetType::AT_CATEGORY, "Contents");
+ mInventory->push_front(inv);
+
+ const LLSD& inventory = inv_result["contents"];
+ for (const auto& inv_entry : llsd::inArray(inventory))
+ {
+ if (inv_entry.has("item_id"))
+ {
+ LLPointer<LLViewerInventoryItem> inv = new LLViewerInventoryItem;
+ inv->unpackMessage(inv_entry);
+ mInventory->push_front(inv);
+ }
+ else
+ {
+ LL_WARNS_ONCE() << "Unknown inventory entry while reading from inventory file. Entry: '"
+ << inv_entry << "'" << LL_ENDL;
+ }
+ }
+ }
+ else
+ {
+ LL_WARNS() << "unable to load task inventory: " << inv_result << LL_ENDL;
+ return;
+ }
+ doInventoryCallback();
+}
+
void LLViewerObject::doInventoryCallback()
{
for (callback_list_t::iterator iter = mInventoryCallbacks.begin();
@@ -7280,6 +7418,7 @@ const std::string& LLViewerObject::getAttachmentItemName() const
//virtual
LLVOAvatar* LLViewerObject::getAvatar() const
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
if (getControlAvatar())
{
return getControlAvatar();
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index b6846c6716..09f813accc 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -688,6 +688,7 @@ private:
// forms task inventory request after some time passed, marks request as pending
void fetchInventoryDelayed(const F64 &time_seconds);
static void fetchInventoryDelayedCoro(const LLUUID task_inv, const F64 time_seconds);
+ static void fetchInventoryFromCapCoro(const LLUUID task_inv);
public:
//
@@ -822,6 +823,7 @@ protected:
static void processTaskInvFile(void** user_data, S32 error_code, LLExtStat ext_status);
bool loadTaskInvFile(const std::string& filename);
+ void loadTaskInvLLSD(const LLSD &inv_result);
void doInventoryCallback();
bool isOnMap();
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 9e1d86faac..6167129077 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -65,6 +65,7 @@
#include "lltoolmgr.h"
#include "lltoolpie.h"
#include "llkeyboard.h"
+#include "llmeshrepository.h"
#include "u64.h"
#include "llviewertexturelist.h"
#include "lldatapacker.h"
@@ -1419,6 +1420,10 @@ void LLViewerObjectList::cleanDeadObjects(bool use_timer)
// No dead objects, don't need to scan object list.
return;
}
+ if ((LLApp::isExiting()) || (mNumDeadObjects == (S32)mObjects.size()))
+ {
+ gMeshRepo.unregisterAllMeshes();
+ }
LL_PROFILE_ZONE_SCOPED;
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index d59dfb88a8..03d5563c65 100755
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -3236,6 +3236,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)
capabilityNames.append("FetchInventory2");
capabilityNames.append("FetchInventoryDescendents2");
capabilityNames.append("IncrementCOFVersion");
+ capabilityNames.append("RequestTaskInventory");
AISAPI::getCapNames(capabilityNames);
capabilityNames.append("InterestList");
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index af6705bd39..ff86684499 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -779,6 +779,8 @@ void send_viewer_stats(bool include_preferences)
LL_INFOS("LogViewerStatsPacket") << "Sending viewer statistics: " << body << LL_ENDL;
+
+ // <ND> Do those lines even do anything sane in regard of debug logging?
LL_DEBUGS("LogViewerStatsPacket");
std::string filename("viewer_stats_packet.xml");
llofstream of(filename.c_str());
diff --git a/indra/newview/llviewerstatsrecorder.cpp b/indra/newview/llviewerstatsrecorder.cpp
index 58065ecce5..3e0e3b28f2 100644
--- a/indra/newview/llviewerstatsrecorder.cpp
+++ b/indra/newview/llviewerstatsrecorder.cpp
@@ -309,5 +309,3 @@ F32 LLViewerStatsRecorder::getTimeSinceStart()
{
return (F32) (LLFrameTimer::getTotalSeconds() - mFileOpenTime);
}
-
-
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index 5793a28b80..210cd62d6f 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -179,6 +179,16 @@ public:
mToolTip = inv_item->getName() + '\n' + inv_item->getDescription();
}
+ /*virtual*/ LLTextSegmentPtr clone(LLTextBase& target) const
+ {
+ LLTextEditor* editor = dynamic_cast<LLTextEditor*>(&target);
+ llassert(editor);
+ if (!editor)
+ return nullptr;
+
+ return new LLEmbeddedItemSegment(mStart, mImage, mItem, *editor);
+ }
+
/*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const
{
if (num_chars == 0)
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 08e9151940..7b89ae4e44 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -964,7 +964,7 @@ void LLViewerTextureList::updateImageDecodePriority(LLViewerFetchedTexture* imag
// this is an alternative to decaying mMaxVirtualSize over time
// that keeps textures from continously downrezzing and uprezzing in the background
- if (LLViewerTexture::sDesiredDiscardBias > 1.5f ||
+ if (LLViewerTexture::sDesiredDiscardBias > 1.5f ||
(!on_screen && LLViewerTexture::sDesiredDiscardBias > 1.f))
{
imagep->mMaxVirtualSize = 0.f;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 5628fd1231..bef667e3bb 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -3776,19 +3776,21 @@ void LLViewerWindow::updateUI()
void LLViewerWindow::updateLayout()
{
- LLTool* tool = LLToolMgr::getInstance()->getCurrentTool();
+ LLToolMgr* tool_mgr = LLToolMgr::getInstance();
+ LLTool* tool = tool_mgr->getCurrentTool();
+ LLCachedControl<bool> freeze_time(gSavedSettings, "FreezeTime");
if (gFloaterTools != NULL
&& tool != NULL
&& tool != gToolNull
&& tool != LLToolCompInspect::getInstance()
&& tool != LLToolDragAndDrop::getInstance()
- && !gSavedSettings.getBOOL("FreezeTime"))
+ && !freeze_time())
{
// Suppress the toolbox view if our source tool was the pie tool,
// and we've overridden to something else.
bool suppress_toolbox =
- (LLToolMgr::getInstance()->getBaseTool() == LLToolPie::getInstance()) &&
- (LLToolMgr::getInstance()->getCurrentTool() != LLToolPie::getInstance());
+ (tool_mgr->getBaseTool() == LLToolPie::getInstance()) &&
+ (tool_mgr->getCurrentTool() != LLToolPie::getInstance());
LLMouseHandler *captor = gFocusMgr.getMouseCapture();
// With the null, inspect, or drag and drop tool, don't muck
@@ -3798,7 +3800,7 @@ void LLViewerWindow::updateLayout()
|| (tool != LLToolPie::getInstance() // not default tool
&& tool != LLToolCompGun::getInstance() // not coming out of mouselook
&& !suppress_toolbox // not override in third person
- && LLToolMgr::getInstance()->getCurrentToolset()->isShowFloaterTools()
+ && tool_mgr->getCurrentToolset()->isShowFloaterTools()
&& (!captor || dynamic_cast<LLView*>(captor) != NULL))) // not dragging
{
// Force floater tools to be visible (unless minimized)
@@ -3888,7 +3890,9 @@ void LLViewerWindow::updateKeyboardFocus()
LLUICtrl* cur_focus = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
if (cur_focus)
{
- if (!cur_focus->isInVisibleChain() || !cur_focus->isInEnabledChain())
+ bool is_in_visible_chain = cur_focus->isInVisibleChain();
+ bool is_in_enabled_chain = cur_focus->isInEnabledChain();
+ if (!is_in_visible_chain || !is_in_enabled_chain)
{
// don't release focus, just reassign so that if being given
// to a sibling won't call onFocusLost on all the ancestors
@@ -3899,11 +3903,19 @@ void LLViewerWindow::updateKeyboardFocus()
bool new_focus_found = false;
while(parent)
{
+ if (!is_in_visible_chain)
+ {
+ is_in_visible_chain = parent->isInVisibleChain();
+ }
+ if (!is_in_enabled_chain)
+ {
+ is_in_enabled_chain = parent->isInEnabledChain();
+ }
if (parent->isCtrl()
&& (parent->hasTabStop() || parent == focus_root)
&& !parent->getIsChrome()
- && parent->isInVisibleChain()
- && parent->isInEnabledChain())
+ && is_in_visible_chain
+ && is_in_enabled_chain)
{
if (!parent->focusFirstItem())
{
@@ -4245,15 +4257,15 @@ void LLViewerWindow::pickAsync( S32 x,
bool pick_unselectable,
bool pick_reflection_probes)
{
+ static LLCachedControl<bool> select_invisible_objects(gSavedSettings, "SelectInvisibleObjects");
// "Show Debug Alpha" means no object actually transparent
bool in_build_mode = LLFloaterReg::instanceVisible("build");
- if (LLDrawPoolAlpha::sShowDebugAlpha
- || (in_build_mode && gSavedSettings.getBOOL("SelectInvisibleObjects")))
+ if (LLDrawPoolAlpha::sShowDebugAlpha || (in_build_mode && select_invisible_objects))
{
pick_transparent = true;
}
- LLPickInfo pick_info(LLCoordGL(x, y_from_bot), mask, pick_transparent, pick_rigged, false, pick_reflection_probes, pick_unselectable, true, callback);
+ LLPickInfo pick_info(LLCoordGL(x, y_from_bot), mask, pick_transparent, pick_rigged, false, pick_reflection_probes, true, pick_unselectable, callback);
schedulePick(pick_info);
}
@@ -4277,7 +4289,6 @@ void LLViewerWindow::schedulePick(LLPickInfo& pick_info)
mWindow->delayInputProcessing();
}
-
void LLViewerWindow::performPick()
{
if (!mPicks.empty())
@@ -4311,8 +4322,9 @@ void LLViewerWindow::returnEmptyPicks()
// Performs the GL object/land pick.
LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, bool pick_transparent, bool pick_rigged, bool pick_particle, bool pick_unselectable, bool pick_reflection_probe)
{
+ static LLCachedControl<bool> select_invisible_objects(gSavedSettings, "SelectInvisibleObjects");
bool in_build_mode = LLFloaterReg::instanceVisible("build");
- if ((in_build_mode && gSavedSettings.getBOOL("SelectInvisibleObjects")) || LLDrawPoolAlpha::sShowDebugAlpha)
+ if ((in_build_mode && select_invisible_objects) || LLDrawPoolAlpha::sShowDebugAlpha)
{
// build mode allows interaction with all transparent objects
// "Show Debug Alpha" means no object actually transparent
@@ -4320,7 +4332,7 @@ LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, bool pick_transp
}
// shortcut queueing in mPicks and just update mLastPick in place
- MASK key_mask = gKeyboard->currentMask(true);
+ MASK key_mask = gKeyboard->currentMask(true);
mLastPick = LLPickInfo(LLCoordGL(x, y_from_bot), key_mask, pick_transparent, pick_rigged, pick_particle, pick_reflection_probe, true, false, NULL);
mLastPick.fetchResults();
@@ -6040,14 +6052,14 @@ LLPickInfo::LLPickInfo(const LLCoordGL& mouse_pos,
bool pick_rigged,
bool pick_particle,
bool pick_reflection_probe,
- bool pick_uv_coords,
+ bool pick_surface_info,
bool pick_unselectable,
void (*pick_callback)(const LLPickInfo& pick_info))
: mMousePt(mouse_pos),
mKeyMask(keyboard_mask),
mPickCallback(pick_callback),
mPickType(PICK_INVALID),
- mWantSurfaceInfo(pick_uv_coords),
+ mWantSurfaceInfo(pick_surface_info),
mObjectFace(-1),
mUVCoords(-1.f, -1.f),
mSTCoords(-1.f, -1.f),
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 7a3f6a6bcb..8178dade8b 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -1647,6 +1647,9 @@ void LLVOAvatar::renderCollisionVolumes()
}
}
+// defined in llspatialpartition.cpp -- draw a box outline in the current GL context from given center and half-size
+void drawBoxOutline(const LLVector4a& pos, const LLVector4a& size);
+
void LLVOAvatar::renderBones(const std::string &selected_joint)
{
LLGLEnable blend(GL_BLEND);
@@ -1723,6 +1726,88 @@ void LLVOAvatar::renderBones(const std::string &selected_joint)
gGL.popMatrix();
}
+
+
+ // draw joint space bounding boxes of rigged attachments in yellow
+ gGL.color3f(1.f, 1.f, 0.f);
+ for (S32 joint_num = 0; joint_num < LL_CHARACTER_MAX_ANIMATED_JOINTS; joint_num++)
+ {
+ LLJoint* joint = getJoint(joint_num);
+ LLJointRiggingInfo* rig_info = NULL;
+ if (joint_num < mJointRiggingInfoTab.size())
+ {
+ rig_info = &mJointRiggingInfoTab[joint_num];
+ }
+
+ if (joint && rig_info && rig_info->isRiggedTo())
+ {
+ LLViewerJointAttachment* as_joint_attach = dynamic_cast<LLViewerJointAttachment*>(joint);
+ if (as_joint_attach && as_joint_attach->getIsHUDAttachment())
+ {
+ // Ignore bounding box of HUD joints
+ continue;
+ }
+ gGL.pushMatrix();
+ gGL.multMatrix(&joint->getXform()->getWorldMatrix().mMatrix[0][0]);
+
+ LLVector4a pos;
+ LLVector4a size;
+
+ const LLVector4a* extents = rig_info->getRiggedExtents();
+
+ pos.setAdd(extents[0], extents[1]);
+ pos.mul(0.5f);
+ size.setSub(extents[1], extents[0]);
+ size.mul(0.5f);
+
+ drawBoxOutline(pos, size);
+
+ gGL.popMatrix();
+ }
+ }
+
+ // draw world space attachment rigged bounding boxes in cyan
+ gGL.color3f(0.f, 1.f, 1.f);
+ for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
+ iter != mAttachmentPoints.end();
+ ++iter)
+ {
+ LLViewerJointAttachment* attachment = iter->second;
+
+ if (attachment->getValid())
+ {
+ for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+ attachment_iter != attachment->mAttachedObjects.end();
+ ++attachment_iter)
+ {
+ LLViewerObject* attached_object = attachment_iter->get();
+ if (attached_object && !attached_object->isHUDAttachment())
+ {
+ LLDrawable* drawable = attached_object->mDrawable;
+ if (drawable && drawable->isState(LLDrawable::RIGGED | LLDrawable::RIGGED_CHILD))
+ {
+ // get face rigged extents
+ for (S32 i = 0; i < drawable->getNumFaces(); ++i)
+ {
+ LLFace* facep = drawable->getFace(i);
+ if (facep && facep->isState(LLFace::RIGGED))
+ {
+ LLVector4a center, size;
+
+ LLVector4a* extents = facep->mRiggedExtents;
+
+ center.setAdd(extents[0], extents[1]);
+ center.mul(0.5f);
+ size.setSub(extents[1], extents[0]);
+ size.mul(0.5f);
+ drawBoxOutline(center, size);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
}
@@ -2322,8 +2407,6 @@ void LLVOAvatar::updateMeshData()
{
if (mDrawable.notNull())
{
- stop_glerror();
-
S32 f_num = 0 ;
const U32 VERTEX_NUMBER_THRESHOLD = 128 ;//small number of this means each part of an avatar has its own vertex buffer.
const auto num_parts = mMeshLOD.size();
@@ -2450,7 +2533,6 @@ void LLVOAvatar::updateMeshData()
}
}
- stop_glerror();
buff->unmapBuffer();
if(!f_num)
@@ -5343,14 +5425,6 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel)
gGL.setSceneBlendType(LLRender::BT_ADD);
gGL.getTexUnit(diffuse_channel)->unbind(LLTexUnit::TT_TEXTURE);
- // gGL.begin(LLRender::QUADS);
- // gGL.vertex3fv((pos+left-up).mV);
- // gGL.vertex3fv((pos-left-up).mV);
- // gGL.vertex3fv((pos-left+up).mV);
- // gGL.vertex3fv((pos+left+up).mV);
- // gGL.end();
-
-
gGL.begin(LLRender::LINES);
gGL.color4f(1.f,1.f,1.f,1.f);
F32 thickness = llmax(F32(5.0f-5.0f*(gFrameTimeSeconds-mLastImpostorUpdateFrameTime)),1.0f);
@@ -5371,15 +5445,22 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel)
gGL.color4ubv(color.mV);
gGL.getTexUnit(diffuse_channel)->bind(&mImpostor);
- gGL.begin(LLRender::QUADS);
- gGL.texCoord2f(0,0);
- gGL.vertex3fv((pos+left-up).mV);
- gGL.texCoord2f(1,0);
- gGL.vertex3fv((pos-left-up).mV);
- gGL.texCoord2f(1,1);
- gGL.vertex3fv((pos-left+up).mV);
- gGL.texCoord2f(0,1);
- gGL.vertex3fv((pos+left+up).mV);
+ gGL.begin(LLRender::TRIANGLES);
+ {
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex3fv((pos + left - up).mV);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3fv((pos - left - up).mV);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex3fv((pos - left + up).mV);
+
+ gGL.texCoord2f(0.f, 0.f);
+ gGL.vertex3fv((pos + left - up).mV);
+ gGL.texCoord2f(1.f, 1.f);
+ gGL.vertex3fv((pos - left + up).mV);
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3fv((pos + left + up).mV);
+ }
gGL.end();
gGL.flush();
}
@@ -10663,35 +10744,39 @@ void LLVOAvatar::updateRiggingInfo()
LL_DEBUGS("RigSpammish") << getFullname() << " updating rig tab" << LL_ENDL;
- std::vector<LLVOVolume*> volumes;
+ // use a local static for scratch space to avoid reallocation here
+ static std::vector<LLVOVolume*> volumes;
+ volumes.resize(0);
getAssociatedVolumes(volumes);
- std::map<LLUUID, S32> curr_rigging_info_key;
-
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_AVATAR("update rig info - get key")
-
+ LL_PROFILE_ZONE_NAMED_CATEGORY_AVATAR("update rig info - get key");
+ size_t hash = 0;
// Get current rigging info key
for (LLVOVolume* vol : volumes)
{
- if (vol->isMesh() && vol->getVolume())
+ if (vol->isRiggedMesh())
{
const LLUUID& mesh_id = vol->getVolume()->getParams().getSculptID();
S32 max_lod = llmax(vol->getLOD(), vol->mLastRiggingInfoLOD);
- curr_rigging_info_key[mesh_id] = max_lod;
+
+ boost::hash_combine(hash, mesh_id);
+ boost::hash_combine(hash, max_lod);
}
}
- }
- // Check for key change, which indicates some change in volume composition or LOD.
- if (curr_rigging_info_key == mLastRiggingInfoKey)
- {
- return;
+ // Check for key change, which indicates some change in volume composition or LOD.
+ if (hash == mLastRiggingInfoKey)
+ {
+ return;
+ }
+
+
+ // Something changed. Update.
+ mLastRiggingInfoKey = hash;
}
- // Something changed. Update.
- mLastRiggingInfoKey = curr_rigging_info_key;
mJointRiggingInfoTab.clear();
for (LLVOVolume* vol : volumes)
{
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index a93ccf46bf..dd1725c322 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -226,7 +226,7 @@ public:
// virtual
void updateRiggingInfo();
// This encodes mesh id and LOD, so we can see whether display is up-to-date.
- std::map<LLUUID,S32> mLastRiggingInfoKey;
+ size_t mLastRiggingInfoKey;
std::set<LLUUID> mActiveOverrideMeshes;
virtual void onActiveOverrideMeshesChanged();
diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp
index 67adcbb244..fdd39a0e30 100644
--- a/indra/newview/llvograss.cpp
+++ b/indra/newview/llvograss.cpp
@@ -729,7 +729,6 @@ void LLGrassPartition::getGeometry(LLSpatialGroup* group)
}
}
- buffer->unmapBuffer();
mFaceList.clear();
}
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 1e934ade59..4659fa5f71 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -1014,6 +1014,7 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon()
std::string old_log = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "SLVoice.old");
if (gDirUtilp->fileExists(new_log))
{
+ LLFile::remove(old_log, ENOENT);
LLFile::rename(new_log, old_log);
}
diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp
index 3d684e5a1b..32803c6117 100644
--- a/indra/newview/llvoicewebrtc.cpp
+++ b/indra/newview/llvoicewebrtc.cpp
@@ -87,6 +87,8 @@ namespace {
const F32 SPEAKING_AUDIO_LEVEL = 0.30;
+ const uint32_t PEER_GAIN_CONVERSION_FACTOR = 220;
+
static const std::string REPORTED_VOICE_SERVER_TYPE = "Secondlife WebRTC Gateway";
// Don't send positional updates more frequently than this:
@@ -2170,7 +2172,7 @@ LLVoiceWebRTCConnection::LLVoiceWebRTCConnection(const LLUUID &regionID, const s
// retries wait a short period...randomize it so
// all clients don't try to reconnect at once.
- mRetryWaitSecs = (F32)((F32) rand() / (RAND_MAX)) + 0.5f;
+ mRetryWaitSecs = static_cast<F32>(rand()) / static_cast<F32>(RAND_MAX) + 0.5f;
mWebRTCPeerConnectionInterface = llwebrtc::newPeerConnection();
mWebRTCPeerConnectionInterface->setSignalingObserver(this);
@@ -2443,7 +2445,7 @@ void LLVoiceWebRTCConnection::setSpeakerVolume(F32 volume)
void LLVoiceWebRTCConnection::setUserVolume(const LLUUID& id, F32 volume)
{
- boost::json::object root = {{"ug", {id.asString(), (uint32_t) (volume * 200)}}};
+ boost::json::object root = { { "ug", { { id.asString(), (uint32_t)(volume * PEER_GAIN_CONVERSION_FACTOR) } } } };
std::string json_data = boost::json::serialize(root);
if (mWebRTCDataInterface)
{
@@ -2453,7 +2455,7 @@ void LLVoiceWebRTCConnection::setUserVolume(const LLUUID& id, F32 volume)
void LLVoiceWebRTCConnection::setUserMute(const LLUUID& id, bool mute)
{
- boost::json::object root = {{"m", {id.asString(), mute}}};
+ boost::json::object root = { { "m", { { id.asString(), mute } } } };
std::string json_data = boost::json::serialize(root);
if (mWebRTCDataInterface)
{
@@ -2766,7 +2768,18 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
case VOICE_STATE_SESSION_UP:
{
mRetryWaitPeriod = 0;
- mRetryWaitSecs = (F32)((F32)rand() / (RAND_MAX)) + 0.5f;
+ mRetryWaitSecs = (F32)((F32)rand() / (F32)RAND_MAX) + 0.5f;
+ LLUUID agentRegionID;
+ if (isSpatial() && gAgent.getRegion())
+ {
+
+ bool primary = (mRegionID == gAgent.getRegion()->getRegionID());
+ if (primary != mPrimary)
+ {
+ mPrimary = primary;
+ sendJoin();
+ }
+ }
// we'll stay here as long as the session remains up.
if (mShutDown)
@@ -2800,7 +2813,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
{
// back off the retry period, and do it by a small random
// bit so all clients don't reconnect at once.
- mRetryWaitSecs += (F32)((F32) rand() / (RAND_MAX)) + 0.5f;
+ mRetryWaitSecs += static_cast<F32>(rand()) / static_cast<F32>(RAND_MAX) + 0.5f;
mRetryWaitPeriod = 0;
}
}
diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp
index 8f792c1042..ec32a79829 100644
--- a/indra/newview/llvopartgroup.cpp
+++ b/indra/newview/llvopartgroup.cpp
@@ -54,63 +54,6 @@ void LLVOPartGroup::initClass()
void LLVOPartGroup::restoreGL()
{
- //TODO: optimize out binormal mask here. Specular and normal coords as well.
-#if 0
- sVB = new LLVertexBuffer(VERTEX_DATA_MASK | LLVertexBuffer::MAP_TANGENT | LLVertexBuffer::MAP_TEXCOORD1 | LLVertexBuffer::MAP_TEXCOORD2);
- U32 count = LL_MAX_PARTICLE_COUNT;
- if (!sVB->allocateBuffer(count*4, count*6))
- {
- LL_WARNS() << "Failed to allocate Vertex Buffer to "
- << count*4 << " vertices and "
- << count * 6 << " indices" << LL_ENDL;
- // we are likelly to crash at following getTexCoord0Strider(), so unref and return
- sVB = NULL;
- return;
- }
-
- //indices and texcoords are always the same, set once
- LLStrider<U16> indicesp;
-
- LLStrider<LLVector4a> verticesp;
-
- sVB->getIndexStrider(indicesp);
- sVB->getVertexStrider(verticesp);
-
- LLVector4a v;
- v.set(0,0,0,0);
-
-
- U16 vert_offset = 0;
-
- for (U32 i = 0; i < LL_MAX_PARTICLE_COUNT; i++)
- {
- *indicesp++ = vert_offset + 0;
- *indicesp++ = vert_offset + 1;
- *indicesp++ = vert_offset + 2;
-
- *indicesp++ = vert_offset + 1;
- *indicesp++ = vert_offset + 3;
- *indicesp++ = vert_offset + 2;
-
- *verticesp++ = v;
-
- vert_offset += 4;
- }
-
- LLStrider<LLVector2> texcoordsp;
- sVB->getTexCoord0Strider(texcoordsp);
-
- for (U32 i = 0; i < LL_MAX_PARTICLE_COUNT; i++)
- {
- *texcoordsp++ = LLVector2(0.f, 1.f);
- *texcoordsp++ = LLVector2(0.f, 0.f);
- *texcoordsp++ = LLVector2(1.f, 1.f);
- *texcoordsp++ = LLVector2(1.f, 0.f);
- }
-
- sVB->unmapBuffer();
-#endif
-
}
//static
@@ -955,7 +898,6 @@ void LLParticlePartition::getGeometry(LLSpatialGroup* group)
}
}
- buffer->unmapBuffer();
mFaceList.clear();
}
diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp
index fdccf34e6a..294d36b0a9 100644
--- a/indra/newview/llvosurfacepatch.cpp
+++ b/indra/newview/llvosurfacepatch.cpp
@@ -1078,7 +1078,6 @@ void LLTerrainPartition::getGeometry(LLSpatialGroup* group)
gen_terrain_tangents(index_offset, indices_index, vertices, normals, tangents, indices, region_width);
}
- buffer->unmapBuffer();
mFaceList.clear();
}
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 4f48a070e3..31f1bbcc21 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -250,10 +250,12 @@ LLVOVolume::~LLVOVolume()
delete mVolumeImpl;
mVolumeImpl = NULL;
- gMeshRepo.unregisterMesh(this);
+ unregisterOldMeshAndSkin();
if(!mMediaImplList.empty())
{
+ LL_PROFILE_ZONE_NAMED_CATEGORY_MEDIA("delete volume media list");
+
for(U32 i = 0 ; i < mMediaImplList.size() ; i++)
{
if(mMediaImplList[i].notNull())
@@ -998,6 +1000,28 @@ LLDrawable *LLVOVolume::createDrawable(LLPipeline *pipeline)
return mDrawable;
}
+// Inverse of gMeshRepo.loadMesh and gMeshRepo.getSkinInfo, combined into one function
+// Assume a Collada mesh never changes after being set.
+void LLVOVolume::unregisterOldMeshAndSkin()
+{
+ if (mVolumep)
+ {
+ const LLVolumeParams& params = mVolumep->getParams();
+ if ((params.getSculptType() & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH)
+ {
+ // object is being deleted, so it will no longer need to request
+ // meshes.
+ for (S32 lod = 0; lod != LLVolumeLODGroup::NUM_LODS; ++lod)
+ {
+ gMeshRepo.unregisterMesh(this, params, lod);
+ }
+ // This volume may or may not have a skin
+ gMeshRepo.unregisterSkinInfo(params.getSculptID(), this);
+ }
+ }
+}
+
+
bool LLVOVolume::setVolume(const LLVolumeParams &params_in, const S32 detail, bool unique_volume)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOLUME;
@@ -3657,7 +3681,7 @@ const LLMeshSkinInfo* LLVOVolume::getSkinInfo() const
// virtual
bool LLVOVolume::isRiggedMesh() const
{
- return isMesh() && getSkinInfo();
+ return getSkinInfo() != nullptr;
}
//----------------------------------------------------------------------------
@@ -3818,7 +3842,6 @@ void LLVOVolume::updateRiggingInfo()
LLVolume *volume = getVolume();
if (skin && avatar && volume)
{
- LL_DEBUGS("RigSpammish") << "starting, vovol " << this << " lod " << getLOD() << " last " << mLastRiggingInfoLOD << LL_ENDL;
if (getLOD()>mLastRiggingInfoLOD || getLOD()==3)
{
// Rigging info may need update
@@ -3834,9 +3857,6 @@ void LLVOVolume::updateRiggingInfo()
}
// Keep the highest LOD info available.
mLastRiggingInfoLOD = getLOD();
- LL_DEBUGS("RigSpammish") << "updated rigging info for LLVOVolume "
- << this << " lod " << mLastRiggingInfoLOD
- << LL_ENDL;
}
}
}
@@ -5783,8 +5803,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
{
type = LLDrawPool::POOL_GLTF_PBR;
}
- else
- if (type != LLDrawPool::POOL_ALPHA && force_simple)
+ else if (type != LLDrawPool::POOL_ALPHA && force_simple)
{
type = LLDrawPool::POOL_SIMPLE;
}
diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h
index 97a5131260..10dbf1349f 100644
--- a/indra/newview/llvovolume.h
+++ b/indra/newview/llvovolume.h
@@ -227,6 +227,7 @@ public:
void setTexture(const S32 face);
S32 getIndexInTex(U32 ch) const {return mIndexInTex[ch];}
+ void unregisterOldMeshAndSkin();
/*virtual*/ bool setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false) override;
void updateSculptTexture();
void setIndexInTex(U32 ch, S32 index) { mIndexInTex[ch] = index ;}
diff --git a/indra/newview/llwindebug.h b/indra/newview/llwindebug.h
index 770584c88d..11b50e3327 100644
--- a/indra/newview/llwindebug.h
+++ b/indra/newview/llwindebug.h
@@ -28,7 +28,7 @@
#define LL_LLWINDEBUG_H
#include "stdtypes.h"
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include <dbghelp.h>
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index ca854ac7f7..6b2bd3e6fb 100755
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -462,11 +462,16 @@ void LLWorldMapView::draw()
gGL.color4f(0.2f, 0.0f, 0.0f, 0.4f);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
+ {
gGL.vertex2f(left, top);
gGL.vertex2f(left, bottom);
gGL.vertex2f(right, bottom);
+
+ gGL.vertex2f(left, top);
+ gGL.vertex2f(right, bottom);
gGL.vertex2f(right, top);
+ }
gGL.end();
}
else if (show_for_sale && (level <= DRAW_LANDFORSALE_THRESHOLD))
@@ -483,15 +488,22 @@ void LLWorldMapView::draw()
{
gGL.getTexUnit(0)->bind(overlayimage);
gGL.color4f(1.f, 1.f, 1.f, 1.f);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
+ {
gGL.texCoord2f(0.f, 1.f);
gGL.vertex3f(left, top, -0.5f);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex3f(left, bottom, -0.5f);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex3f(right, bottom, -0.5f);
+
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3f(left, top, -0.5f);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3f(right, bottom, -0.5f);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex3f(right, top, -0.5f);
+ }
gGL.end();
}
}
@@ -737,15 +749,22 @@ bool LLWorldMapView::drawMipmapLevel(S32 width, S32 height, S32 level, bool load
gGL.color4f(1.f, 1.0f, 1.0f, 1.0f);
- gGL.begin(LLRender::QUADS);
+ gGL.begin(LLRender::TRIANGLES);
+ {
gGL.texCoord2f(0.f, 1.f);
gGL.vertex3f(left, top, 0.f);
gGL.texCoord2f(0.f, 0.f);
gGL.vertex3f(left, bottom, 0.f);
gGL.texCoord2f(1.f, 0.f);
gGL.vertex3f(right, bottom, 0.f);
+
+ gGL.texCoord2f(0.f, 1.f);
+ gGL.vertex3f(left, top, 0.f);
+ gGL.texCoord2f(1.f, 0.f);
+ gGL.vertex3f(right, bottom, 0.f);
gGL.texCoord2f(1.f, 1.f);
gGL.vertex3f(right, top, 0.f);
+ }
gGL.end();
#if DEBUG_DRAW_TILE
drawTileOutline(level, top, left, bottom, right);
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index 48461241a2..07e2b118d3 100644
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -26,7 +26,7 @@
#include "llviewerprecompiledheaders.h"
// include this to get winsock2 because openssl attempts to include winsock1
-#include "llwin32headerslean.h"
+#include "llwin32headers.h"
#include <openssl/x509_vfy.h>
#include <openssl/ssl.h>
#include "llsecapi.h"
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 081f4a3564..3a811f893e 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -125,7 +125,7 @@
#define A_GCC 1
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wunused-variable"
-#if LL_LINUX
+#if LL_LINUX && defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic ignored "-Wrestrict"
#endif
#endif
@@ -219,7 +219,7 @@ S32 LLPipeline::RenderHeroProbeUpdateRate;
S32 LLPipeline::RenderHeroProbeConservativeUpdateMultiplier;
LLTrace::EventStatHandle<S64> LLPipeline::sStatBatchSize("renderbatchsize");
-const U32 LLPipeline::MAX_BAKE_WIDTH = 512;
+const U32 LLPipeline::MAX_PREVIEW_WIDTH = 512;
const F32 BACKLIGHT_DAY_MAGNITUDE_OBJECT = 0.1f;
const F32 BACKLIGHT_NIGHT_MAGNITUDE_OBJECT = 0.08f;
@@ -878,6 +878,8 @@ bool LLPipeline::allocateScreenBufferInternal(U32 resX, U32 resY)
// used to scale down textures
// See LLViwerTextureList::updateImagesCreateTextures and LLImageGL::scaleDown
mDownResMap.allocate(4, 4, GL_RGBA);
+
+ mBakeMap.allocate(LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH, LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT, GL_RGBA);
}
//HACK make screenbuffer allocations start failing after 30 seconds
if (gSavedSettings.getBOOL("SimulateFBOFailure"))
@@ -1138,6 +1140,8 @@ void LLPipeline::releaseGLBuffers()
mDownResMap.release();
+ mBakeMap.release();
+
for (U32 i = 0; i < 3; i++)
{
mGlow[i].release();
@@ -3727,6 +3731,7 @@ void LLPipeline::postSort(LLCamera &camera)
}
}
+ LLVertexBuffer::flushBuffers();
// LLSpatialGroup::sNoDelete = false;
LL_PUSH_CALLSTACKS();
}
@@ -7065,7 +7070,7 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst)
LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
- bool no_post = gSnapshotNoPost || (buildNoPost && gFloaterTools->isAvailable());
+ bool no_post = gSnapshotNoPost || psky->getReflectionProbeAmbiance(should_auto_adjust) == 0.f || (buildNoPost && gFloaterTools->isAvailable());
LLGLSLShader& shader = no_post ? gNoPostTonemapProgram : gDeferredPostTonemapProgram;
shader.bind();
@@ -7915,6 +7920,8 @@ void LLPipeline::renderFinalize()
gDeferredPostNoDoFNoiseProgram.bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, finalBuffer);
gDeferredPostNoDoFNoiseProgram.bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
+ gDeferredPostNoDoFNoiseProgram.uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, (GLfloat)finalBuffer->getWidth(), (GLfloat)finalBuffer->getHeight());
+
{
LLGLDepthTest depth_test(GL_TRUE, GL_TRUE, GL_ALWAYS);
mScreenTriangleVB->setBuffer();
@@ -10890,11 +10897,16 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar, bool preview_avatar, bool
gGL.diffuseColor4fv(LLColor4::pink.mV );
}
- gGL.begin(LLRender::QUADS);
- gGL.vertex3f(-1, -1, clip_plane);
- gGL.vertex3f(1, -1, clip_plane);
- gGL.vertex3f(1, 1, clip_plane);
- gGL.vertex3f(-1, 1, clip_plane);
+ gGL.begin(LLRender::TRIANGLES);
+ {
+ gGL.vertex3f(-1.f, -1.f, clip_plane);
+ gGL.vertex3f(1.f, -1.f, clip_plane);
+ gGL.vertex3f(1.f, 1.f, clip_plane);
+
+ gGL.vertex3f(-1.f, -1.f, clip_plane);
+ gGL.vertex3f(1.f, 1.f, clip_plane);
+ gGL.vertex3f(-1.f, 1.f, clip_plane);
+ }
gGL.end();
gGL.flush();
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index a3ecab3208..5c9b95ef4a 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -737,6 +737,9 @@ public:
// downres scratch space for GPU downscaling of textures
LLRenderTarget mDownResMap;
+ // 2k bom scratch target
+ LLRenderTarget mBakeMap;
+
LLCullResult mSky;
LLCullResult mReflectedObjects;
LLCullResult mRefractedObjects;
@@ -776,7 +779,7 @@ public:
//water distortion texture (refraction)
LLRenderTarget mWaterDis;
- static const U32 MAX_BAKE_WIDTH;
+ static const U32 MAX_PREVIEW_WIDTH;
//texture for making the glow
LLRenderTarget mGlow[3];
diff --git a/indra/newview/skins/default/xui/da/language_settings.xml b/indra/newview/skins/default/xui/da/language_settings.xml
index 0e3cbfd2d2..d31afb320a 100644
--- a/indra/newview/skins/default/xui/da/language_settings.xml
+++ b/indra/newview/skins/default/xui/da/language_settings.xml
@@ -5,6 +5,7 @@
<!-- Locale Information -->
<string name="MicrosoftLocale">danish</string>
<string name="MacLocale">da_DK.UTF-8</string>
+ <string name="macOSLocale">da_DK.UTF-8</string>
<string name="DarwinLocale">da_DK.UTF-8</string>
<string name="LinuxLocale">da_DK.UTF-8</string>
diff --git a/indra/newview/skins/default/xui/de/language_settings.xml b/indra/newview/skins/default/xui/de/language_settings.xml
index f9346eef7d..57a327b345 100644
--- a/indra/newview/skins/default/xui/de/language_settings.xml
+++ b/indra/newview/skins/default/xui/de/language_settings.xml
@@ -5,6 +5,7 @@
<!-- Locale Information -->
<string name="MicrosoftLocale">german</string>
<string name="MacLocale">de_DE.UTF-8</string>
+ <string name="macOSLocale">de_DE.UTF-8</string>
<string name="DarwinLocale">de_DE.UTF-8</string>
<string name="LinuxLocale">de_DE.UTF-8</string>
diff --git a/indra/newview/skins/default/xui/en/floater_emoji_picker.xml b/indra/newview/skins/default/xui/en/floater_emoji_picker.xml
index e4b8f13df7..f642ca93b7 100644
--- a/indra/newview/skins/default/xui/en/floater_emoji_picker.xml
+++ b/indra/newview/skins/default/xui/en/floater_emoji_picker.xml
@@ -13,7 +13,6 @@
chrome="true"
height="350"
width="304">
- <floater.string name="title_for_recently_used" value="Recently used"/>
<floater.string name="title_for_frequently_used" value="Frequently used"/>
<floater.string name="text_no_emoji_for_filter" value="No emoji found for '[FILTER]'"/>
<scroll_container
diff --git a/indra/newview/skins/default/xui/en/floater_fast_timers.xml b/indra/newview/skins/default/xui/en/floater_fast_timers.xml
index 00411ba20b..ae907bcb5f 100644
--- a/indra/newview/skins/default/xui/en/floater_fast_timers.xml
+++ b/indra/newview/skins/default/xui/en/floater_fast_timers.xml
@@ -75,7 +75,7 @@
step_size="16"
doc_pos="0"
doc_size="3000"
- page_size="0"
+ page_size="50"
/>
</layout_panel>
<layout_panel name="timers_panel"
diff --git a/indra/newview/skins/default/xui/en/floater_gltf_asset_editor.xml b/indra/newview/skins/default/xui/en/floater_gltf_asset_editor.xml
index b17d0aa5b6..025d537804 100644
--- a/indra/newview/skins/default/xui/en/floater_gltf_asset_editor.xml
+++ b/indra/newview/skins/default/xui/en/floater_gltf_asset_editor.xml
@@ -11,10 +11,10 @@
name="gltf asset editor"
title="[OBJECT_NAME]">
<floater.string name="floater_title" value="GLTF Scene Editor"/>
- <floater.string name="scene_tittle" value="Scene"/>
- <floater.string name="node_tittle" value="Node"/>
- <floater.string name="mesh_tittle" value="Mesh"/>
- <floater.string name="skin_tittle" value="Skin"/>
+ <floater.string name="scene_title" value="Scene"/>
+ <floater.string name="node_title" value="Node"/>
+ <floater.string name="mesh_title" value="Mesh"/>
+ <floater.string name="skin_title" value="Skin"/>
<layout_stack
name="main_layout"
diff --git a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml
index 1deb81175e..2fa965b6e4 100644
--- a/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml
+++ b/indra/newview/skins/default/xui/en/floater_preferences_graphics_advanced.xml
@@ -222,7 +222,7 @@
height="16"
increment="1"
initial_value="12"
- label="Max. # of non-impostors:"
+ label="Max. # animated avatars:"
label_width="185"
layout="topleft"
left="30"
diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml
index b0b818cde5..5ab0177de6 100644
--- a/indra/newview/skins/default/xui/en/floater_world_map.xml
+++ b/indra/newview/skins/default/xui/en/floater_world_map.xml
@@ -37,7 +37,8 @@
top="16"
left="0"
right="-1"
- bottom="-1">
+ bottom="-1"
+ orientation="horizontal">
<layout_panel
name="map_lp"
width="385"
diff --git a/indra/newview/skins/default/xui/en/language_settings.xml b/indra/newview/skins/default/xui/en/language_settings.xml
index dd521c09d0..12a1b52a84 100644
--- a/indra/newview/skins/default/xui/en/language_settings.xml
+++ b/indra/newview/skins/default/xui/en/language_settings.xml
@@ -5,6 +5,7 @@
<!-- Locale Information -->
<string name="MicrosoftLocale">english</string>
<string name="MacLocale">C</string>
+ <string name="macOSLocale">C</string>
<string name="DarwinLocale">C</string>
<string name="LinuxLocale">C</string>
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index f4864dabef..43cdf30ba0 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -4248,16 +4248,6 @@ function="World.EnvPreset"
<menu_item_separator/>
- <menu_item_check
- label="HTTP Textures"
- name="HTTP Textures">
- <menu_item_check.on_check
- function="CheckControl"
- parameter="ImagePipelineUseHTTP" />
- <menu_item_check.on_click
- function="ToggleControl"
- parameter="ImagePipelineUseHTTP" />
- </menu_item_check>
<menu_item_call
label="Compress Images"
name="Compress Images">
diff --git a/indra/newview/skins/default/xui/en/mime_types_linux.xml b/indra/newview/skins/default/xui/en/mime_types_linux.xml
index d0ecd0a11c..87284f564b 100644
--- a/indra/newview/skins/default/xui/en/mime_types_linux.xml
+++ b/indra/newview/skins/default/xui/en/mime_types_linux.xml
@@ -7,7 +7,7 @@
none
</defaultwidget>
<defaultimpl>
- media_plugin_webkit
+ media_plugin_cef
</defaultimpl>
<widgetset name="web">
<label name="web_label">
@@ -130,7 +130,7 @@
movie
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</scheme>
<mimetype name="blank">
@@ -141,7 +141,7 @@
none
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype name="none/none">
@@ -152,7 +152,7 @@
none
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype name="audio/*">
@@ -163,7 +163,7 @@
audio
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype name="video/*">
@@ -174,7 +174,7 @@
movie
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype name="image/*">
@@ -185,7 +185,7 @@
image
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype menu="1" name="video/vnd.secondlife.qt.legacy">
@@ -196,7 +196,7 @@
movie
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype name="application/javascript">
@@ -207,7 +207,7 @@
web
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype name="application/ogg">
@@ -218,7 +218,7 @@
audio
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype name="application/pdf">
@@ -229,7 +229,7 @@
image
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype name="application/postscript">
@@ -240,7 +240,7 @@
image
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype name="application/rtf">
@@ -251,7 +251,7 @@
image
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype name="application/smil">
@@ -262,7 +262,7 @@
movie
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype name="application/xhtml+xml">
@@ -273,7 +273,7 @@
web
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype name="application/x-director">
@@ -284,7 +284,7 @@
image
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype name="audio/mid">
@@ -295,7 +295,7 @@
audio
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype name="audio/mpeg">
@@ -306,7 +306,7 @@
audio
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype name="audio/x-aiff">
@@ -317,7 +317,7 @@
audio
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype name="audio/x-wav">
@@ -328,7 +328,7 @@
audio
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype menu="1" name="image/bmp">
@@ -339,7 +339,7 @@
image
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype menu="1" name="image/gif">
@@ -350,7 +350,7 @@
image
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype menu="1" name="image/jpeg">
@@ -361,7 +361,7 @@
image
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype menu="1" name="image/png">
@@ -372,7 +372,7 @@
image
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype name="image/svg+xml">
@@ -383,7 +383,7 @@
image
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype menu="1" name="image/tiff">
@@ -394,7 +394,7 @@
image
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype menu="1" name="text/html">
@@ -405,7 +405,7 @@
web
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype menu="1" name="text/plain">
@@ -416,7 +416,7 @@
text
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype name="text/xml">
@@ -427,7 +427,7 @@
text
</widgettype>
<impl>
- media_plugin_webkit
+ media_plugin_cef
</impl>
</mimetype>
<mimetype menu="1" name="video/mpeg">
@@ -438,7 +438,7 @@
movie
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype name="video/mp4">
@@ -449,7 +449,7 @@
movie
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype menu="1" name="video/quicktime">
@@ -460,7 +460,7 @@
movie
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype name="video/x-ms-asf">
@@ -471,7 +471,7 @@
movie
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype name="video/x-ms-wmv">
@@ -482,7 +482,7 @@
movie
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
<mimetype menu="1" name="video/x-msvideo">
@@ -493,7 +493,7 @@
movie
</widgettype>
<impl>
- media_plugin_libvlc
+ media_plugin_gstreamer
</impl>
</mimetype>
</mimetypes>
diff --git a/indra/newview/skins/default/xui/en/panel_group_roles.xml b/indra/newview/skins/default/xui/en/panel_group_roles.xml
index 02e135a2c7..868d54401e 100644
--- a/indra/newview/skins/default/xui/en/panel_group_roles.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_roles.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<panel
- height="750"
+ height="770"
label="Members &amp; Roles"
layout="topleft"
left="0"
@@ -18,9 +18,9 @@
<panel.string
name="help_text" />
<tab_container
- border="false"
+ border="false"
follows="left|top|right"
- height="552"
+ height="770"
halign="center"
layout="topleft"
left="0"
@@ -29,16 +29,10 @@
tab_position="top"
tab_height="22"
tab_min_width="90"
- top="0"
- width="304">
+ top="0">
<panel
border="false"
- follows="all"
- height="303"
label="MEMBERS"
- layout="topleft"
- left="0"
- right="-1"
help_topic="roles_members_tab"
name="members_sub_tab"
tool_tip="Members"
@@ -65,16 +59,16 @@ clicking on their names.
name="power_partial_icon" translate="false">
Checkbox_Off
</panel.string>
- <filter_editor
- layout="topleft"
- top="5"
- left="5"
- right="-5"
- height="22"
- search_button_visible="false"
- follows="left|top|right"
- label="Filter Members"
- name="filter_input" />
+ <filter_editor
+ layout="topleft"
+ top="5"
+ left="5"
+ right="-5"
+ height="22"
+ search_button_visible="false"
+ follows="left|top|right"
+ label="Filter Members"
+ name="filter_input" />
<name_list
column_padding="2"
draw_heading="true"
@@ -90,11 +84,11 @@ clicking on their names.
<name_list.columns
label="Member"
name="name"
- relative_width="0.44" />
+ relative_width="0.44" />
<name_list.columns
label="Donation"
name="donated"
- relative_width="0.2" />
+ relative_width="0.2" />
<name_list.columns
label="Status"
name="online"
@@ -118,25 +112,21 @@ clicking on their names.
left_pad="10"
name="member_eject"
width="100" />
- <button
- height="23"
- label="Ban Member(s)"
- follows="top|left"
- left_pad="10"
- name="member_ban"
- width="100" />
+ <button
+ height="23"
+ label="Ban Member(s)"
+ follows="top|left"
+ left_pad="10"
+ name="member_ban"
+ width="100" />
</panel>
<panel
border="false"
- height="303"
label="ROLES"
- layout="topleft"
- left="0"
- right="-1"
help_topic="roles_roles_tab"
name="roles_sub_tab"
class="panel_group_roles_subtab">
- <!-- <button
+ <!--<button
enabled="false"
height="20"
label="Show All"
@@ -145,411 +135,393 @@ clicking on their names.
right="-5"
name="show_all_button"
width="100" />-->
- <panel.string
- name="help_text">
- Roles have a title and an allowed list of Abilities
- that Members can perform. Members can belong to
- one or more Roles. A group can have up to 10 Roles,
- including the Everyone and Owner Roles.
- </panel.string>
- <panel.string
- name="cant_delete_role">
- The &apos;Everyone&apos; and &apos;Owners&apos; Roles are special and can't be deleted.
- </panel.string>
- <panel.string
- name="power_folder_icon" translate="false">
- Inv_FolderClosed
- </panel.string>
- <panel.string
- name="power_all_have_icon" translate="false">
- Checkbox_On
- </panel.string>
- <panel.string
- name="power_partial_icon" translate="false">
- Checkbox_Off
- </panel.string>
- <filter_editor
- layout="topleft"
- top="5"
- left="5"
- right="-5"
- height="22"
- search_button_visible="false"
- follows="left|top|right"
- label="Filter Roles"
- name="filter_input" />
- <scroll_list
- column_padding="0"
- draw_heading="true"
- draw_stripes="false"
- heading_height="23"
- height="132"
- layout="topleft"
- search_column="1"
- left="0"
- follows="left|top|right"
- right="-1"
- name="role_list"
- top_pad="2"
- width="310">
- <scroll_list.columns
- label="Role"
- name="name"
- relative_width="0.45" />
- <scroll_list.columns
- label="Title"
- name="title"
- relative_width="0.45" />
- <scroll_list.columns
- label="#"
- name="members"
- relative_width="0.15" />
- </scroll_list>
- <button
- follows="top|left"
- height="23"
- label="New Role"
- layout="topleft"
- left="0"
- name="role_create"
- width="100" />
- <button
- follows="top|left"
- height="23"
- label="Copy Role"
- layout="topleft"
- left_pad="10"
- name="role_copy"
- width="100" />
- <button
- height="23"
- follows="top|left"
- label="Delete Role"
- layout="topleft"
- left_pad="10"
- name="role_delete"
- width="100" />
- </panel>
+ <panel.string
+ name="help_text">
+ Roles have a title and an allowed list of Abilities
+that Members can perform. Members can belong to
+one or more Roles. A group can have up to 10 Roles,
+including the Everyone and Owner Roles.
+ </panel.string>
+ <panel.string
+ name="cant_delete_role">
+ The &apos;Everyone&apos; and &apos;Owners&apos; Roles are special and can't be deleted.
+ </panel.string>
+ <panel.string
+ name="power_folder_icon" translate="false">
+ Inv_FolderClosed
+ </panel.string>
+ <panel.string
+ name="power_all_have_icon" translate="false">
+ Checkbox_On
+ </panel.string>
+ <panel.string
+ name="power_partial_icon" translate="false">
+ Checkbox_Off
+ </panel.string>
+ <filter_editor
+ layout="topleft"
+ top="5"
+ left="5"
+ right="-5"
+ height="22"
+ search_button_visible="false"
+ follows="left|top|right"
+ label="Filter Roles"
+ name="filter_input" />
+ <scroll_list
+ column_padding="0"
+ draw_heading="true"
+ draw_stripes="false"
+ heading_height="23"
+ height="138"
+ layout="topleft"
+ search_column="1"
+ left="0"
+ follows="left|top|right"
+ right="-1"
+ name="role_list"
+ top_pad="2">
+ <scroll_list.columns
+ label="Role"
+ name="name"
+ relative_width="0.45" />
+ <scroll_list.columns
+ label="Title"
+ name="title"
+ relative_width="0.45" />
+ <scroll_list.columns
+ label="#"
+ name="members"
+ relative_width="0.15" />
+ </scroll_list>
+ <button
+ follows="top|left"
+ height="23"
+ label="New Role"
+ layout="topleft"
+ left="0"
+ name="role_create"
+ width="100" />
+ <button
+ follows="top|left"
+ height="23"
+ label="Copy Role"
+ layout="topleft"
+ left_pad="10"
+ name="role_copy"
+ width="100" />
+ <button
+ height="23"
+ follows="top|left"
+ label="Delete Role"
+ layout="topleft"
+ left_pad="10"
+ name="role_delete"
+ width="100" />
+ </panel>
+ <panel
+ border="false"
+ label="ABILITIES"
+ help_topic="roles_actions_tab"
+ name="actions_sub_tab"
+ class="panel_group_actions_subtab"
+ tool_tip="You can view an Ability&apos;s Description and which Roles and Members can execute the Ability.">
+ <panel.string
+ name="help_text">
+ Abilities allow Members in Roles to do specific
+things in this group. There&apos;s a broad variety of Abilities.
+ </panel.string>
+ <panel.string
+ name="power_folder_icon" translate="false">
+ Inv_FolderClosed
+ </panel.string>
+ <panel.string
+ name="power_all_have_icon" translate="false">
+ Checkbox_On
+ </panel.string>
+ <panel.string
+ name="power_partial_icon" translate="false">
+ Checkbox_Off
+ </panel.string>
+ <filter_editor
+ layout="topleft"
+ top="5"
+ left="5"
+ right="-5"
+ height="22"
+ search_button_visible="false"
+ follows="left|top|right"
+ label="Filter Abilities"
+ name="filter_input" />
+ <scroll_list
+ column_padding="0"
+ draw_stripes="true"
+ height="200"
+ follows="left|top|right"
+ layout="topleft"
+ left="0"
+ right="-1"
+ name="action_list"
+ search_column="2"
+ tool_tip="Select an Ability to view more details"
+ top_pad="5">
+ <scroll_list.columns
+ label=""
+ name="icon"
+ width="2" />
+ <scroll_list.columns
+ label=""
+ name="checkbox"
+ width="20" />
+ <scroll_list.columns
+ label=""
+ name="action" />
+ </scroll_list>
+ </panel>
+ <panel
+ border="false"
+ label="BANNED RESIDENTS"
+ help_topic="roles_banlist_tab"
+ name="banlist_sub_tab"
+ class="panel_group_banlist_subtab"
+ tool_tip="View the banned residents from this group.">
+ <panel.string
+ name="help_text">
+ Any resident on the ban list will be unable to join the group.
+ </panel.string>
+ <panel.string
+ name="ban_count_template">
+ Ban count: [COUNT]/[LIMIT]
+ </panel.string>
+ <name_list
+ column_padding="0"
+ draw_heading="true"
+ height="714"
+ follows="left|top|right"
+ layout="topleft"
+ left="0"
+ right="-1"
+ multi_select="true"
+ name="ban_list"
+ short_names="false"
+ top_pad="5">
+ <name_list.columns
+ label="Resident"
+ name="name"
+ font.name="SANSSERIF_SMALL"
+ font.style="NORMAL"
+ relative_width="0.7" />
+ <name_list.columns
+ label="Date Banned"
+ name="ban_date"
+ relative_width="0.3" />
+ </name_list>
+ <button
+ follows="top|left"
+ height="23"
+ label="Ban Resident(s)"
+ layout="topleft"
+ left="3"
+ name="ban_create"
+ tool_tip="Ban residents from your group"
+ width="120" />
+ <button
+ follows="top|left"
+ height="23"
+ label="Remove Ban(s)"
+ layout="topleft"
+ left_pad="5"
+ name="ban_delete"
+ tool_tip="Unban selected residents from your group"
+ width="120" />
+ <button
+ follows="top|left"
+ height="23"
+ width="23"
+ image_overlay="Refresh_Off"
+ layout="topleft"
+ left_pad="5"
+ name="ban_refresh"
+ tool_tip="Refresh the ban list" />
+ <text
+ type="string"
+ height="18"
+ left_pad="5"
+ follows="top|left"
+ layout="topleft"
+ name="ban_count"
+ width="100">
+ </text>
+ </panel>
+ </tab_container>
<panel
- border="false"
- height="303"
- label="ABILITIES"
+ height="350"
+ background_visible="false"
+ bg_alpha_color="FloaterUnfocusBorderColor"
layout="topleft"
+ follows="top|left|right"
left="0"
right="-1"
- help_topic="roles_actions_tab"
- name="actions_sub_tab"
- class="panel_group_actions_subtab"
- tool_tip="You can view an Ability&apos;s Description and which Roles and Members can execute the Ability."
- width="310">
- <panel.string
- name="help_text">
- Abilities allow Members in Roles to do specific
- things in this group. There&apos;s a broad variety of Abilities.
- </panel.string>
- <panel.string
- name="power_folder_icon" translate="false">
- Inv_FolderClosed
- </panel.string>
- <panel.string
- name="power_all_have_icon" translate="false">
- Checkbox_On
- </panel.string>
- <panel.string
- name="power_partial_icon" translate="false">
- Checkbox_Off
- </panel.string>
- <filter_editor
- layout="topleft"
- top="5"
- left="5"
- right="-5"
- height="22"
- search_button_visible="false"
- follows="left|top|right"
- label="Filter Abilities"
- name="filter_input" />
- <scroll_list
- column_padding="0"
- draw_stripes="true"
- height="200"
- follows="left|top|right"
- layout="topleft"
- left="0"
- right="-1"
- name="action_list"
- search_column="2"
- tool_tip="Select an Ability to view more details"
- top_pad="5"
- width="300">
- <scroll_list.columns
- label=""
- name="icon"
- width="2" />
- <scroll_list.columns
- label=""
- name="checkbox"
- width="20" />
- <scroll_list.columns
- label=""
- name="action" />
- </scroll_list>
+ mouse_opaque="false"
+ name="members_footer"
+ top="325"
+ visible="false">
+ <text
+ type="string"
+ height="16"
+ layout="topleft"
+ follows="left|top"
+ left="5"
+ top="8"
+ text_color="EmphasisColor"
+ name="static"
+ width="300">
+ Assigned Roles
+ </text>
+ <scroll_list
+ draw_stripes="true"
+ follows="left|top|right"
+ height="150"
+ layout="topleft"
+ left="0"
+ right="-1"
+ name="member_assigned_roles"
+ top_pad="0">
+ <scroll_list.columns
+ label=""
+ name="checkbox"
+ width="20" />
+ <scroll_list.columns
+ label=""
+ name="role"
+ width="270" />
+ </scroll_list>
+ <text
+ type="string"
+ height="16"
+ layout="topleft"
+ follows="left|top"
+ left="5"
+ top_pad="5"
+ text_color="EmphasisColor"
+ name="static2"
+ width="285">
+ Allowed Abilities
+ </text>
+ <scroll_list
+ draw_stripes="true"
+ follows="left|top|right"
+ height="150"
+ layout="topleft"
+ left="0"
+ right="-1"
+ name="member_allowed_actions"
+ search_column="2"
+ tool_tip="For details of each allowed ability see the abilities tab"
+ top_pad="0">
+ <scroll_list.columns
+ label=""
+ name="icon"
+ width="2" />
+ <scroll_list.columns
+ label=""
+ name="checkbox"
+ width="20" />
+ <scroll_list.columns
+ label=""
+ name="action"
+ width="270" />
+ </scroll_list>
</panel>
<panel
- border="false"
- height="303"
- label="BANNED RESIDENTS"
+ height="90"
+ background_visible="false"
+ bg_alpha_color="FloaterUnfocusBorderColor"
layout="topleft"
+ follows="top|left|right"
left="0"
right="-1"
- help_topic="roles_banlist_tab"
- name="banlist_sub_tab"
- class="panel_group_banlist_subtab"
- tool_tip="View the banned residents from this group."
- width="310">
- <panel.string
- name="help_text">
- Any resident on the ban list will be unable to join the group.
- </panel.string>
- <panel.string
- name="ban_count_template">
- Ban count: [COUNT]/[LIMIT]
- </panel.string>
- <name_list
- column_padding="0"
- draw_heading="true"
- height="400"
- follows="left|top|right"
- layout="topleft"
- left="0"
- right="-1"
- multi_select="true"
- name="ban_list"
- short_names="false"
- top_pad="5">
- <name_list.columns
- label="Resident"
- name="name"
- font.name="SANSSERIF_SMALL"
- font.style="NORMAL"
- relative_width="0.7" />
- <name_list.columns
- label="Date Banned"
- name="ban_date"
- relative_width="0.3" />
- </name_list>
- <button
- follows="top|left"
- height="23"
- label="Ban Resident(s)"
- layout="topleft"
- left="3"
- name="ban_create"
- tool_tip="Ban residents from your group"
- width="120" />
- <button
- follows="top|left"
- height="23"
- label="Remove Ban(s)"
- layout="topleft"
- left_pad="5"
- name="ban_delete"
- tool_tip="Unban selected residents from your group"
- width="120" />
- <button
- follows="top|left"
- height="23"
- width="23"
- image_overlay="Refresh_Off"
- layout="topleft"
- left_pad="5"
- name="ban_refresh"
- tool_tip="Refresh the ban list"
- />
- <text
- type="string"
- height="18"
- left_pad="5"
- follows="top|left"
- layout="topleft"
- name="ban_count"
- width="100">
- </text>
+ mouse_opaque="false"
+ name="members_header"
+ top_pad="3"
+ visible="false">
+ <text_editor
+ bg_readonly_color="Transparent"
+ text_readonly_color="EmphasisColor"
+ font="SansSerifSmall"
+ type="string"
+ enabled="false"
+ halign="left"
+ layout="topleft"
+ top_pad="0"
+ follows="left|top|right"
+ left="0"
+ right="-1"
+ height="90"
+ max_length="512"
+ name="member_action_description"
+ word_wrap="true">
+ This Ability is &apos;Eject Members from this Group&apos;. Only an Owner can eject another Owner.
+ </text_editor>
</panel>
- </tab_container>
- <panel
- height="350"
- background_visible="false"
- bg_alpha_color="FloaterUnfocusBorderColor"
- layout="topleft"
- follows="top|left|right"
- left="0"
- right="-1"
- width="313"
- mouse_opaque="false"
- name="members_footer"
- top="325"
- visible="false">
- <text
- type="string"
- height="16"
- layout="topleft"
- follows="left|top"
- left="5"
- top="8"
- text_color="EmphasisColor"
- name="static"
- width="300">
- Assigned Roles
- </text>
- <scroll_list
- draw_stripes="true"
- follows="left|top|right"
- height="150"
+ <panel
+ height="460"
+ background_visible="false"
+ bg_alpha_color="FloaterUnfocusBorderColor"
layout="topleft"
+ follows="top|left|right"
left="0"
right="-1"
- name="member_assigned_roles"
- top_pad="0">
- <scroll_list.columns
- label=""
- name="checkbox"
- width="20" />
- <scroll_list.columns
- label=""
- name="role"
- width="270" />
- </scroll_list>
- <text
- type="string"
- height="16"
- layout="topleft"
- follows="left|top"
- left="5"
- top_pad="5"
- text_color="EmphasisColor"
- name="static2"
- width="285">
- Allowed Abilities
- </text>
- <scroll_list
- draw_stripes="true"
+ mouse_opaque="false"
+ name="roles_footer"
+ top_delta="0"
+ top="215"
+ visible="false">
+ <text
+ type="string"
+ height="16"
+ layout="topleft"
+ follows="left|top"
+ left="5"
+ top="5"
+ name="static"
+ width="300">
+ Role Name
+ </text>
+ <line_editor
+ type="string"
+ height="20"
+ layout="topleft"
+ left="0"
follows="left|top|right"
- height="150"
- layout="topleft"
- left="0"
- right="-1"
- name="member_allowed_actions"
- search_column="2"
- tool_tip="For details of each allowed ability see the abilities tab"
- top_pad="0">
- <scroll_list.columns
- label=""
- name="icon"
- width="2" />
- <scroll_list.columns
- label=""
- name="checkbox"
- width="20" />
- <scroll_list.columns
- label=""
- name="action"
- width="270" />
- </scroll_list>
- </panel>
- <panel
- height="90"
- background_visible="false"
- bg_alpha_color="FloaterUnfocusBorderColor"
- layout="topleft"
- follows="top|left|right"
- left="0"
- right="-1"
- width="313"
- mouse_opaque="false"
- name="members_header"
- top_pad="3"
- visible="false">
- <text_editor
- bg_readonly_color="Transparent"
- text_readonly_color="EmphasisColor"
- font="SansSerifSmall"
- type="string"
- enabled="false"
- halign="left"
- layout="topleft"
- top_pad="0"
- follows="left|top|right"
- left="0"
- right="-1"
- height="90"
- max_length="512"
- name="member_action_description"
- word_wrap="true">
- This Ability is &apos;Eject Members from this Group&apos;. Only an Owner can eject another Owner.
- </text_editor>
- </panel>
- <panel
- height="460"
- background_visible="false"
- bg_alpha_color="FloaterUnfocusBorderColor"
- layout="topleft"
- follows="top|left|right"
- left="0"
- right="-1"
- width="313"
- mouse_opaque="false"
- name="roles_footer"
- top_delta="0"
- top="209"
- visible="false">
- <text
- type="string"
- height="16"
- layout="topleft"
- follows="left|top"
- left="5"
- top="5"
- name="static"
- width="300">
- Role Name
- </text>
- <line_editor
- type="string"
- height="20"
- layout="topleft"
- left="0"
- follows="left|top|right"
- right="-1"
- max_length_bytes="20"
- name="role_name"
- top_pad="0"
- width="300">
- </line_editor>
- <text
- type="string"
- height="16"
- layout="topleft"
- follows="left|top"
- left="5"
- name="static3"
- top_pad="5"
- width="300">
- Role Title
- </text>
- <line_editor
- type="string"
- height="20"
- layout="topleft"
- left="0"
- follows="left|top|right"
- right="-1"
- max_length_bytes="20"
- name="role_title"
- top_pad="0"
- width="300">
- </line_editor>
- <text
+ right="-1"
+ max_length_bytes="20"
+ name="role_name"
+ top_pad="0">
+ </line_editor>
+ <text
+ type="string"
+ height="16"
+ layout="topleft"
+ follows="left|top"
+ left="5"
+ name="static3"
+ top_pad="5"
+ width="300">
+ Role Title
+ </text>
+ <line_editor
+ type="string"
+ height="20"
+ layout="topleft"
+ left="0"
+ follows="left|top|right"
+ right="-1"
+ max_length_bytes="20"
+ name="role_title"
+ top_pad="0">
+ </line_editor>
+ <text
type="string"
height="16"
layout="topleft"
@@ -558,192 +530,185 @@ clicking on their names.
name="static2"
top_pad="5"
width="200">
- Description
- </text>
- <text_editor
- type="string"
- layout="topleft"
- left="0"
- follows="left|top|right"
- right="-1"
- max_length="295"
- height="35"
- name="role_description"
- top_pad="0"
- width="300"
- word_wrap="true">
- </text_editor>
- <text
- type="string"
- height="16"
- layout="topleft"
- follows="left|top"
- left="5"
- text_color="EmphasisColor"
- name="static4"
- top_pad="5"
- width="300">
- Assigned Members
- </text>
- <name_list
- draw_stripes="true"
- height="128"
- layout="topleft"
- left="0"
- follows="left|top|right"
- right="-1"
- name="role_assigned_members"
- top_pad="0"
- width="300" />
- <check_box
- height="15"
- label="Reveal members"
- left="5"
- layout="topleft"
- name="role_visible_in_list"
- tool_tip="Sets whether members of this role are visible in the General tab to people outside of the group."
- top_pad="4"
- width="300" />
- <text
- type="string"
- height="16"
- layout="topleft"
- follows="left|top"
- left="5"
- text_color="EmphasisColor"
- name="static5"
- top_pad="2"
- width="300">
- Allowed Abilities
- </text>
- <scroll_list
- draw_stripes="true"
- height="140"
- layout="topleft"
- left="0"
- follows="left|top|right"
- right="-1"
- name="role_allowed_actions"
- search_column="2"
- tool_tip="For details of each allowed ability see the abilities tab"
- top_pad="0"
- width="300">
- <scroll_list.columns
- label=""
- name="icon"
- width="2" />
- <scroll_list.columns
- label=""
- name="checkbox"
- width="20" />
- <scroll_list.columns
- label=""
- name="action" />
- </scroll_list>
- </panel>
- <panel
- height="90"
- background_visible="false"
- bg_alpha_color="FloaterUnfocusBorderColor"
- layout="topleft"
- follows="top|left|right"
- left="0"
- right="-1"
- width="313"
- mouse_opaque="false"
- name="roles_header"
- top_pad="3"
- visible="false">
- <text_editor
- bg_readonly_color="Transparent"
- text_readonly_color="EmphasisColor"
- font="SansSerifSmall"
- type="string"
- enabled="false"
- halign="left"
- layout="topleft"
- top_pad="0"
- follows="left|top|right"
- left="0"
- right="-1"
+ Description
+ </text>
+ <text_editor
+ type="string"
+ layout="topleft"
+ left="0"
+ follows="left|top|right"
+ right="-1"
+ max_length="295"
+ height="35"
+ name="role_description"
+ top_pad="0"
+ word_wrap="true">
+ </text_editor>
+ <text
+ type="string"
+ height="16"
+ layout="topleft"
+ follows="left|top"
+ left="5"
+ text_color="EmphasisColor"
+ name="static4"
+ top_pad="5"
+ width="300">
+ Assigned Members
+ </text>
+ <name_list
+ draw_stripes="true"
+ height="128"
+ layout="topleft"
+ left="0"
+ follows="left|top|right"
+ right="-1"
+ name="role_assigned_members"
+ top_pad="0" />
+ <check_box
+ height="15"
+ label="Reveal members"
+ left="5"
+ layout="topleft"
+ name="role_visible_in_list"
+ tool_tip="Sets whether members of this role are visible in the General tab to people outside of the group."
+ top_pad="4"
+ width="300" />
+ <text
+ type="string"
+ height="16"
+ layout="topleft"
+ follows="left|top"
+ left="5"
+ text_color="EmphasisColor"
+ name="static5"
+ top_pad="2"
+ width="300">
+ Allowed Abilities
+ </text>
+ <scroll_list
+ draw_stripes="true"
+ height="140"
+ layout="topleft"
+ left="0"
+ follows="left|top|right"
+ right="-1"
+ name="role_allowed_actions"
+ search_column="2"
+ tool_tip="For details of each allowed ability see the abilities tab"
+ top_pad="0">
+ <scroll_list.columns
+ label=""
+ name="icon"
+ width="2" />
+ <scroll_list.columns
+ label=""
+ name="checkbox"
+ width="20" />
+ <scroll_list.columns
+ label=""
+ name="action" />
+ </scroll_list>
+ </panel>
+ <panel
height="90"
- max_length="512"
- name="role_action_description"
- word_wrap="true">
- This Ability is &apos;Eject Members from this Group&apos;. Only an Owner can eject another Owner.
- </text_editor>
- </panel>
- <panel
- height="424"
- background_visible="false"
- bg_alpha_color="FloaterUnfocusBorderColor"
- layout="topleft"
- follows="top|left|right"
- left="0"
- right="-1"
- width="313"
- mouse_opaque="false"
- name="actions_footer"
- top_delta="0"
- top="255"
- visible="false">
- <text_editor
- bg_readonly_color="Transparent"
- text_readonly_color="EmphasisColor"
- font="SansSerifSmall"
- type="string"
- enabled="false"
- halign="left"
+ background_visible="false"
+ bg_alpha_color="FloaterUnfocusBorderColor"
layout="topleft"
- follows="left|top|right"
+ follows="top|left|right"
left="0"
right="-1"
- height="90"
- max_length="512"
- name="action_description"
- top="0"
- word_wrap="true">
- This Ability is &apos;Eject Members from this Group&apos;. Only an Owner can eject another Owner.
- </text_editor>
- <text
- type="string"
- height="16"
- layout="topleft"
- follows="left|top"
- left="5"
- name="static2"
- top_pad="1"
- width="300">
- Roles with this ability
- </text>
- <scroll_list
- height="172"
- layout="topleft"
- follows="left|top|right"
- left="5"
- right="-1"
- name="action_roles"
- top_pad="0"
- width="300" />
- <text
- type="string"
- height="16"
- layout="topleft"
- follows="left|top"
- left="5"
- name="static3"
- top_pad="5"
- width="300">
- Members with this ability
- </text>
- <name_list
- height="122"
- follows="left|top|right"
+ mouse_opaque="false"
+ name="roles_header"
+ top_pad="3"
+ visible="false">
+ <text_editor
+ bg_readonly_color="Transparent"
+ text_readonly_color="EmphasisColor"
+ font="SansSerifSmall"
+ type="string"
+ enabled="false"
+ halign="left"
+ layout="topleft"
+ top_pad="0"
+ follows="left|top|right"
+ left="0"
+ right="-1"
+ height="90"
+ max_length="512"
+ name="role_action_description"
+ word_wrap="true">
+ This Ability is &apos;Eject Members from this Group&apos;. Only an Owner can eject another Owner.
+ </text_editor>
+ </panel>
+ <panel
+ height="513"
+ background_visible="false"
+ bg_alpha_color="FloaterUnfocusBorderColor"
layout="topleft"
- left="5"
+ follows="top|left|right"
+ left="0"
right="-1"
- name="action_members"
- top_pad="0"
- width="300" />
- </panel>
+ mouse_opaque="false"
+ name="actions_footer"
+ top_delta="0"
+ top="255"
+ visible="false">
+ <text_editor
+ bg_readonly_color="Transparent"
+ text_readonly_color="EmphasisColor"
+ font="SansSerifSmall"
+ type="string"
+ enabled="false"
+ halign="left"
+ layout="topleft"
+ follows="left|top|right"
+ left="0"
+ right="-1"
+ height="90"
+ max_length="512"
+ name="action_description"
+ top="0"
+ word_wrap="true">
+ This Ability is &apos;Eject Members from this Group&apos;. Only an Owner can eject another Owner.
+ </text_editor>
+ <text
+ type="string"
+ height="16"
+ layout="topleft"
+ follows="left|top"
+ left="5"
+ name="static2"
+ top_pad="1"
+ width="300">
+ Roles with this ability
+ </text>
+ <scroll_list
+ height="216"
+ layout="topleft"
+ follows="left|top|right"
+ left="5"
+ right="-1"
+ name="action_roles"
+ top_pad="0" />
+ <text
+ type="string"
+ height="16"
+ layout="topleft"
+ follows="left|top"
+ left="5"
+ name="static3"
+ top_pad="5"
+ width="300">
+ Members with this ability
+ </text>
+ <name_list
+ height="167"
+ follows="left|top|right"
+ layout="topleft"
+ left="5"
+ right="-1"
+ name="action_members"
+ top_pad="0" />
+ </panel>
</panel>
diff --git a/indra/newview/skins/default/xui/en/panel_login_first.xml b/indra/newview/skins/default/xui/en/panel_login_first.xml
index c906e2f96c..d6ac71db94 100644
--- a/indra/newview/skins/default/xui/en/panel_login_first.xml
+++ b/indra/newview/skins/default/xui/en/panel_login_first.xml
@@ -179,7 +179,6 @@
control_name="RememberPassword"
follows="left|top"
font="SansSerifLarge"
- text_color="EmphasisColor"
height="24"
left="262"
bottom_delta="0"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
index 5d347397bf..cb3e0e4b6a 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
@@ -210,26 +210,60 @@
increment="8"
initial_value="160"
label="Draw distance:"
- label_width="90"
+ label_width="187"
layout="topleft"
left="30"
min_val="64"
max_val="512"
name="DrawDistance"
top_delta="40"
- width="330" />
+ width="427" />
<text
type="string"
length="1"
follows="left|top"
height="12"
layout="topleft"
- left_delta="330"
+ left_delta="427"
name="DrawDistanceMeterText2"
top_delta="0"
width="128">
m
</text>
+ <slider
+ control_name="IndirectMaxNonImpostors"
+ name="IndirectMaxNonImpostors"
+ decimal_digits="0"
+ increment="1"
+ initial_value="12"
+ show_text="false"
+ min_val="1"
+ max_val="66"
+ label="Maximum number of animated avatars:"
+ follows="left|top"
+ layout="topleft"
+ height="16"
+ label_width="240"
+ left="30"
+ top_delta="40"
+ width="393">
+ <slider.commit_callback
+ function="Pref.UpdateIndirectMaxNonImpostors"
+ parameter="IndirectNonImpostorsText" />
+ </slider>
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="16"
+ layout="topleft"
+ top_delta="0"
+ left_delta="397"
+ text_readonly_color="LabelDisabledColor"
+ name="IndirectMaxNonImpostorsText"
+ width="65">
+ 0
+ </text>
<button
height="23"
diff --git a/indra/newview/skins/default/xui/en/panel_profile_pick.xml b/indra/newview/skins/default/xui/en/panel_profile_pick.xml
index 024120931f..4f441b9b49 100644
--- a/indra/newview/skins/default/xui/en/panel_profile_pick.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile_pick.xml
@@ -200,6 +200,26 @@
<layout_panel
follows="all"
+ layout="bottomleft"
+ left_pad="2"
+ name="set_to_curr_location_btn_lp"
+ auto_resize="false"
+ width="100">
+ <button
+ name="set_to_curr_location_btn"
+ label="Set Location"
+ tool_tip="Set to Current Location"
+ left="0"
+ top="0"
+ height="23"
+ width="100"
+ follows="left|top"
+ layout="topleft"
+ />
+ </layout_panel>
+
+ <layout_panel
+ follows="all"
layout="topleft"
name="util_resizer_right"
auto_resize="true"
diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml
index 6d23592948..6531233696 100644
--- a/indra/newview/skins/default/xui/en/panel_region_environment.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml
@@ -264,8 +264,7 @@
top_pad="1"
halign="right"
name="txt_alt1">
- Sky [INDEX]
- [ALTITUDE]m
+ Sky [INDEX]&#xA;[ALTITUDE]m
</text>
<line_editor
follows="left|top"
@@ -310,8 +309,7 @@
top_pad="1"
halign="right"
name="txt_alt2">
- Sky [INDEX]
- [ALTITUDE]m
+ Sky [INDEX]&#xA;[ALTITUDE]m
</text>
<line_editor
follows="left|top"
@@ -356,8 +354,7 @@
top_pad="1"
halign="right"
name="txt_alt3">
- Sky [INDEX]
- [ALTITUDE]m
+ Sky [INDEX]&#xA;[ALTITUDE]m
</text>
<line_editor
follows="left|top"
diff --git a/indra/newview/skins/default/xui/es/language_settings.xml b/indra/newview/skins/default/xui/es/language_settings.xml
index 997293a741..7a52f7cdae 100644
--- a/indra/newview/skins/default/xui/es/language_settings.xml
+++ b/indra/newview/skins/default/xui/es/language_settings.xml
@@ -5,6 +5,7 @@
<!-- Locale Information -->
<string name="MicrosoftLocale">spanish</string>
<string name="MacLocale">es_ES.UTF-8</string>
+ <string name="macOSLocale">es_ES.UTF-8</string>
<string name="DarwinLocale">es_ES.UTF-8</string>
<string name="LinuxLocale">es_ES.UTF-8</string>
diff --git a/indra/newview/skins/default/xui/fr/language_settings.xml b/indra/newview/skins/default/xui/fr/language_settings.xml
index fdac9d65a7..fdb119ec69 100644
--- a/indra/newview/skins/default/xui/fr/language_settings.xml
+++ b/indra/newview/skins/default/xui/fr/language_settings.xml
@@ -5,6 +5,7 @@
<!-- Locale Information -->
<string name="MicrosoftLocale">french</string>
<string name="MacLocale">fr_FR.UTF-8</string>
+ <string name="macOSLocale">fr_FR.UTF-8</string>
<string name="DarwinLocale">fr_FR.UTF-8</string>
<string name="LinuxLocale">fr_FR.UTF-8</string>
diff --git a/indra/newview/skins/default/xui/it/language_settings.xml b/indra/newview/skins/default/xui/it/language_settings.xml
index 5f448fa828..7eb1b560bd 100644
--- a/indra/newview/skins/default/xui/it/language_settings.xml
+++ b/indra/newview/skins/default/xui/it/language_settings.xml
@@ -5,6 +5,7 @@
<!-- Locale Information -->
<string name="MicrosoftLocale">italian</string>
<string name="MacLocale">it_IT.UTF-8</string>
+ <string name="macOSLocale">it_IT.UTF-8</string>
<string name="DarwinLocale">it_IT.UTF-8</string>
<string name="LinuxLocale">it_IT.UTF-8</string>
diff --git a/indra/newview/skins/default/xui/ja/language_settings.xml b/indra/newview/skins/default/xui/ja/language_settings.xml
index facae22acf..c94a16cee0 100644
--- a/indra/newview/skins/default/xui/ja/language_settings.xml
+++ b/indra/newview/skins/default/xui/ja/language_settings.xml
@@ -6,6 +6,9 @@
<string name="MacLocale">
ja_JP.UTF-8
</string>
+ <string name="macOSLocale">
+ ja_JP.UTF-8
+ </string>
<string name="DarwinLocale">
ja_JP.UTF-8
</string>
diff --git a/indra/newview/skins/default/xui/pl/language_settings.xml b/indra/newview/skins/default/xui/pl/language_settings.xml
index 0057ca530c..9993062487 100644
--- a/indra/newview/skins/default/xui/pl/language_settings.xml
+++ b/indra/newview/skins/default/xui/pl/language_settings.xml
@@ -2,6 +2,7 @@
<strings>
<string name="MicrosoftLocale">polish</string>
<string name="MacLocale">pl_PL.UTF-8</string>
+ <string name="macOSLocale">pl_PL.UTF-8</string>
<string name="DarwinLocale">pl_PL.UTF-8</string>
<string name="LinuxLocale">pl_PL.UTF-8</string>
<string name="TimeHour">hour,datetime,slt</string>
diff --git a/indra/newview/skins/default/xui/pt/language_settings.xml b/indra/newview/skins/default/xui/pt/language_settings.xml
index 8799475ace..d5be208eb3 100644
--- a/indra/newview/skins/default/xui/pt/language_settings.xml
+++ b/indra/newview/skins/default/xui/pt/language_settings.xml
@@ -5,6 +5,7 @@
<!-- Locale Information -->
<string name="MicrosoftLocale">portuguese</string>
<string name="MacLocale">pt_PT.UTF-8</string>
+ <string name="macOSLocale">pt_PT.UTF-8</string>
<string name="DarwinLocale">pt_PT.UTF-8</string>
<string name="LinuxLocale">pt_PT.UTF-8</string>
diff --git a/indra/newview/tests/lldateutil_test.cpp b/indra/newview/tests/lldateutil_test.cpp
index 151aadfd4b..acbf019034 100644
--- a/indra/newview/tests/lldateutil_test.cpp
+++ b/indra/newview/tests/lldateutil_test.cpp
@@ -57,12 +57,12 @@ std::string LLTrans::getString(const std::string_view xml_desc, const LLStringUt
return {};
}
-std::string LLTrans::getCountString(const std::string& language, const std::string& xml_desc, S32 count)
+std::string LLTrans::getCountString(std::string_view language, std::string_view xml_desc, S32 count)
{
count_string_t key(xml_desc, count);
if (gCountString.find(key) == gCountString.end())
{
- return std::string("Couldn't find ") + xml_desc;
+ return std::string("Couldn't find ") + static_cast<std::string>(xml_desc);
}
return gCountString[ count_string_t(xml_desc, count) ];
}
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 9f77dba3bc..daa7e58211 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -65,6 +65,8 @@ class ViewerManifest(LLManifest):
self.path(src="../../scripts/messages/message_template.msg", dst="app_settings/message_template.msg")
self.path(src="../../etc/message.xml", dst="app_settings/message.xml")
+ os.environ["XZ_DEFAULTS"] = "-T0"
+
if self.is_packaging_viewer():
with self.prefix(src_dst="app_settings"):
self.exclude("logcontrol.xml")
@@ -277,7 +279,7 @@ class ViewerManifest(LLManifest):
# All lines up to and including the first blank line are the file header; skip them
lines.reverse() # so that pop will pull from first to last line
- while not re.match("\s*$", lines.pop()) :
+ while not re.match(r"\s*$", lines.pop()) :
pass # do nothing
# A line that starts with a non-whitespace character is a name; all others describe contributions, so collect the names
@@ -1191,6 +1193,9 @@ class LinuxManifest(ViewerManifest):
super(LinuxManifest, self).construct()
pkgdir = os.path.join(self.args['build'], os.pardir, 'packages')
+ if "package_dir" in self.args:
+ pkgdir = self.args['package_dir']
+
relpkgdir = os.path.join(pkgdir, "lib", "release")
debpkgdir = os.path.join(pkgdir, "lib", "debug")
@@ -1209,49 +1214,125 @@ class LinuxManifest(ViewerManifest):
with self.prefix(dst="bin"):
self.path("secondlife-bin","do-not-directly-run-secondlife-bin")
- self.path("../linux_crash_logger/linux-crash-logger","linux-crash-logger.bin")
+ #self.path("../linux_crash_logger/linux-crash-logger","linux-crash-logger.bin")
self.path2basename("../llplugin/slplugin", "SLPlugin")
#this copies over the python wrapper script, associated utilities and required libraries, see SL-321, SL-322 and SL-323
- with self.prefix(src="../viewer_components/manager", dst=""):
- self.path("*.py")
+ #with self.prefix(src="../viewer_components/manager", dst=""):
+ # self.path("*.py")
# recurses, packaged again
self.path("res-sdl")
+ # We copy ll_icon.BMP in CMakeLists.txt to newview/res-sdl and this will let the above self.path step take care of copying
+ # the correct branded icon
# Get the icons based on the channel type
icon_path = self.icon_path()
- print("DEBUG: icon_path '%s'" % icon_path)
+ #print("DEBUG: icon_path '%s'" % icon_path)
with self.prefix(src=icon_path) :
self.path("secondlife_256.png","secondlife_icon.png")
with self.prefix(dst="res-sdl") :
self.path("secondlife_256.BMP","ll_icon.BMP")
- # plugins
- with self.prefix(src="../media_plugins", dst="bin/llplugin"):
- self.path("gstreamer010/libmedia_plugin_gstreamer010.so",
- "libmedia_plugin_gstreamer.so")
- self.path2basename("libvlc", "libmedia_plugin_libvlc.so")
-
- with self.prefix(src=os.path.join(pkgdir, 'lib', 'vlc', 'plugins'), dst="bin/llplugin/vlc/plugins"):
- self.path( "plugins.dat" )
- self.path( "*/*.so" )
+ with self.prefix(src=os.path.join(self.args['build'], os.pardir, "llwebrtc" ), dst="lib"):
+ self.path("libllwebrtc.so")
- with self.prefix(src=os.path.join(pkgdir, 'lib' ), dst="lib"):
- self.path( "libvlc*.so*" )
-
- # llcommon
- if not self.path("../llcommon/libllcommon.so", "lib/libllcommon.so"):
- print("Skipping llcommon.so (assuming llcommon was linked statically)")
+ # plugins
+ with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'media_plugins'), dst="bin/llplugin"):
+ self.path("gstreamer10/libmedia_plugin_gstreamer10.so", "libmedia_plugin_gstreamer.so")
+
+ with self.prefix(src=os.path.join(self.args['build'], os.pardir, 'media_plugins'), dst="bin/llplugin"):
+ self.path("cef/libmedia_plugin_cef.so", "libmedia_plugin_cef.so" )
+ with self.prefix(src=os.path.join(pkgdir, 'lib', 'release'), dst="lib"):
+ self.path( "libcef.so" )
+
+ self.path( "libEGL*" )
+ self.path( "libvulkan*" )
+ self.path( "libvk_swiftshader*" )
+ self.path( "libGLESv2*" )
+ self.path( "vk_swiftshader_icd.json")
+
+ with self.prefix(src=os.path.join(pkgdir, 'bin', 'release'), dst="bin"):
+ self.path( "chrome-sandbox" )
+ self.path( "dullahan_host" )
+ self.path( "snapshot_blob.bin" )
+ self.path( "v8_context_snapshot.bin" )
+ with self.prefix(src=os.path.join(pkgdir, 'bin', 'release'), dst="lib"):
+ self.path( "snapshot_blob.bin" )
+ self.path( "v8_context_snapshot.bin" )
+
+ with self.prefix(src=os.path.join(pkgdir, 'resources'), dst="lib"):
+ self.path( "chrome_100_percent.pak" )
+ self.path( "chrome_200_percent.pak" )
+ self.path( "resources.pak" )
+ self.path( "icudtl.dat" )
+
+ with self.prefix(src=os.path.join(pkgdir, 'resources', 'locales'), dst=os.path.join('lib', 'locales')):
+ self.path("am.pak")
+ self.path("ar.pak")
+ self.path("bg.pak")
+ self.path("bn.pak")
+ self.path("ca.pak")
+ self.path("cs.pak")
+ self.path("da.pak")
+ self.path("de.pak")
+ self.path("el.pak")
+ self.path("en-GB.pak")
+ self.path("en-US.pak")
+ self.path("es-419.pak")
+ self.path("es.pak")
+ self.path("et.pak")
+ self.path("fa.pak")
+ self.path("fi.pak")
+ self.path("fil.pak")
+ self.path("fr.pak")
+ self.path("gu.pak")
+ self.path("he.pak")
+ self.path("hi.pak")
+ self.path("hr.pak")
+ self.path("hu.pak")
+ self.path("id.pak")
+ self.path("it.pak")
+ self.path("ja.pak")
+ self.path("kn.pak")
+ self.path("ko.pak")
+ self.path("lt.pak")
+ self.path("lv.pak")
+ self.path("ml.pak")
+ self.path("mr.pak")
+ self.path("ms.pak")
+ self.path("nb.pak")
+ self.path("nl.pak")
+ self.path("pl.pak")
+ self.path("pt-BR.pak")
+ self.path("pt-PT.pak")
+ self.path("ro.pak")
+ self.path("ru.pak")
+ self.path("sk.pak")
+ self.path("sl.pak")
+ self.path("sr.pak")
+ self.path("sv.pak")
+ self.path("sw.pak")
+ self.path("ta.pak")
+ self.path("te.pak")
+ self.path("th.pak")
+ self.path("tr.pak")
+ self.path("uk.pak")
+ self.path("vi.pak")
+ self.path("zh-CN.pak")
+ self.path("zh-TW.pak")
self.path("featuretable_linux.txt")
self.path("cube.dae")
- with self.prefix(src=pkgdir):
+ with self.prefix(src=pkgdir, dst="bin"):
self.path("ca-bundle.crt")
def package_finish(self):
installer_name = self.installer_base_name()
+ # When running as a GitHub Action job, RUNNER_TEMP is defined as the tmp dir
+ RUNNER_TEMP = os.getenv('RUNNER_TEMP')
+
self.strip_binaries()
# Fix access permissions
@@ -1266,84 +1347,77 @@ class LinuxManifest(ViewerManifest):
# temporarily move directory tree so that it has the right
# name in the tarfile
realname = self.get_dst_prefix()
- tempname = self.build_path_of(installer_name)
- self.run_command(["mv", realname, tempname])
+ versionedName = self.build_path_of(installer_name)
+
+ tarName = versionedName + ".tar.xz"
+
+ # If using a github runner we divert packaging a little. Considering this wil be a VM/docker image
+ # we can just pack the final installer into RUNNER_TEMP and not into the usual stop we'd pick when
+ # not building a GHA release
+ if RUNNER_TEMP:
+ tarName = os.path.join(RUNNER_TEMP, self.package_file)
+
+ self.run_command(["mv", realname, versionedName])
+
try:
# only create tarball if it's a release build.
if self.args['buildtype'].lower() == 'release':
- # --numeric-owner hides the username of the builder for
- # security etc.
self.run_command(['tar', '-C', self.get_build_prefix(),
'--numeric-owner', '-cJf',
- tempname + '.tar.xz', installer_name])
+ tarName, installer_name])
+ self.set_github_output_path('viewer_app', tarName)
else:
print("Skipping %s.tar.xz for non-Release build (%s)" % \
(installer_name, self.args['buildtype']))
finally:
- self.run_command(["mv", tempname, realname])
+ self.run_command(["mv", versionedName, realname])
def strip_binaries(self):
+ doStrip = False
if self.args['buildtype'].lower() == 'release' and self.is_packaging_viewer():
- print("* Going strip-crazy on the packaged binaries, since this is a RELEASE build")
+ doStrip = True
+ # In case of flatpak flatpak-build will call strip, disable doStrip here to get a flatpak symbol package. Increases flatpak size by about 1G
+ if "FLATPAK_DEST" in os.environ:
+ doStrip = True
+
+ if doStrip:
+ print("* Going strip-crazy on the packaged binaries, since this is a Release build")
# makes some small assumptions about our packaged dir structure
self.run_command(
["find"] +
[os.path.join(self.get_dst_prefix(), dir) for dir in ('bin', 'lib')] +
['-type', 'f', '!', '-name', '*.py',
+ '!', '-name', '*.pak',
+ '!', '-name', '*.bin',
+ '!', '-name', '*.dat',
+ '!', '-name', '*.crt',
+ '!', '-name', '*.dll',
+ '!', '-name', '*.lib',
'!', '-name', 'update_install', '-exec', 'strip', '-S', '{}', ';'])
-class Linux_i686_Manifest(LinuxManifest):
- address_size = 32
+class Linux_x86_64_Manifest(LinuxManifest):
+ address_size = 64
def construct(self):
- super(Linux_i686_Manifest, self).construct()
+ super(Linux_x86_64_Manifest, self).construct()
pkgdir = os.path.join(self.args['build'], os.pardir, 'packages')
+ if "package_dir" in self.args:
+ pkgdir = self.args['package_dir']
+
relpkgdir = os.path.join(pkgdir, "lib", "release")
debpkgdir = os.path.join(pkgdir, "lib", "debug")
with self.prefix(src=relpkgdir, dst="lib"):
- self.path("libdb*.so")
- self.path("libuuid.so*")
- self.path("libSDL-1.2.so.*")
- self.path("libdirectfb-1.*.so.*")
- self.path("libfusion-1.*.so.*")
- self.path("libdirect-1.*.so.*")
- self.path("libopenjp2.so*")
- self.path("libdirectfb-1.4.so.5")
- self.path("libfusion-1.4.so.5")
- self.path("libdirect-1.4.so.5*")
+ self.path("libapr-1.so*")
+ self.path("libaprutil-1.so*")
+ self.path_optional("libSDL*.so.*")
+
+ self.path_optional("libjemalloc*.so")
+
self.path("libalut.so*")
self.path("libopenal.so*")
self.path("libopenal.so", "libvivoxoal.so.1") # vivox's sdk expects this soname
- # KLUDGE: As of 2012-04-11, the 'fontconfig' package installs
- # libfontconfig.so.1.4.4, along with symlinks libfontconfig.so.1
- # and libfontconfig.so. Before we added support for library-file
- # wildcards, though, this self.path() call specifically named
- # libfontconfig.so.1.4.4 WITHOUT also copying the symlinks. When I
- # (nat) changed the call to self.path("libfontconfig.so.*"), we
- # ended up with the libfontconfig.so.1 symlink in the target
- # directory as well. But guess what! At least on Ubuntu 10.04,
- # certain viewer fonts look terrible with libfontconfig.so.1
- # present in the target directory. Removing that symlink suffices
- # to improve them. I suspect that means we actually do better when
- # the viewer fails to find our packaged libfontconfig.so*, falling
- # back on the system one instead -- but diagnosing and fixing that
- # is a bit out of scope for the present project. Meanwhile, this
- # particular wildcard specification gets us exactly what the
- # previous call did, without having to explicitly state the
- # version number.
- self.path("libfontconfig.so.*.*")
-
- # Include libfreetype.so. but have it work as libfontconfig does.
- self.path("libfreetype.so.*.*")
-
- try:
- self.path("libtcmalloc.so*") #formerly called google perf tools
- pass
- except:
- print("tcmalloc files not found, skipping")
- pass
# Vivox runtimes
with self.prefix(src=relpkgdir, dst="bin"):
@@ -1355,17 +1429,6 @@ class Linux_i686_Manifest(LinuxManifest):
self.path("libvivoxsdk.so")
self.strip_binaries()
-
-
-class Linux_x86_64_Manifest(LinuxManifest):
- address_size = 64
-
- def construct(self):
- super(Linux_x86_64_Manifest, self).construct()
-
- # support file for valgrind debug tool
- self.path("secondlife-i686.supp")
-
################################################################
if __name__ == "__main__":
diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index 0a817c32dd..c002edd94c 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -35,6 +35,7 @@
*/
#include "linden_common.h"
+#include "llexception.h"
#include "chained_callback.h"
#include "fsyspath.h"
#include "llerrorcontrol.h"
@@ -165,10 +166,6 @@ public:
LLTestCallback(bool verbose_mode, std::ostream *stream,
std::shared_ptr<LLReplayLog> replayer) :
mVerboseMode(verbose_mode),
- mTotalTests(0),
- mPassedTests(0),
- mFailedTests(0),
- mSkippedTests(0),
// By default, capture a shared_ptr to std::cout, with a no-op "deleter"
// so that destroying the shared_ptr makes no attempt to delete std::cout.
mStream(std::shared_ptr<std::ostream>(&std::cout, [](std::ostream*){})),
@@ -204,6 +201,8 @@ public:
virtual void group_started(const std::string& name) {
LL_INFOS("TestRunner")<<"Unit test group_started name=" << name << LL_ENDL;
*mStream << "Unit test group_started name=" << name << std::endl;
+ mGroup = name;
+ mGroupTests = 0;
super::group_started(name);
}
@@ -216,6 +215,7 @@ public:
virtual void test_completed(const tut::test_result& tr)
{
++mTotalTests;
+ ++mGroupTests;
// If this test failed, dump requested log messages BEFORE stating the
// test result.
@@ -303,12 +303,15 @@ public:
super::run_completed();
}
+ std::string mGroup;
+ int mGroupTests{ 0 };
+
protected:
- bool mVerboseMode;
- int mTotalTests;
- int mPassedTests;
- int mFailedTests;
- int mSkippedTests;
+ bool mVerboseMode{ false };
+ int mTotalTests{ 0 };
+ int mPassedTests{ 0 };
+ int mFailedTests{ 0 };
+ int mSkippedTests{ 0 };
std::shared_ptr<std::ostream> mStream;
std::shared_ptr<LLReplayLog> mReplayer;
};
@@ -659,14 +662,47 @@ int main(int argc, char **argv)
// a chained_callback subclass must be linked with previous
mycallback->link();
- if(test_group.empty())
- {
- tut::runner.get().run_tests();
- }
- else
- {
- tut::runner.get().run_tests(test_group);
- }
+ LL::seh::catcher(
+ // __try
+ [test_group]
+ {
+ if(test_group.empty())
+ {
+ tut::runner.get().run_tests();
+ }
+ else
+ {
+ tut::runner.get().run_tests(test_group);
+ }
+ },
+ // __except
+ [mycallback](U32 code, const std::string& /*stacktrace*/)
+ {
+ static std::map<U32, const char*> codes = {
+ { 0xC0000005, "Access Violation" },
+ { 0xC00000FD, "Stack Overflow" },
+ // ... continue filling in as desired
+ };
+
+ auto found{ codes.find(code) };
+ const char* name = ((found == codes.end())? "unknown" : found->second);
+ auto msg{ stringize("test threw ", std::hex, code, " (", name, ")") };
+
+ // Instead of bombing the whole test run, report this as a test
+ // failure. Arguably, catching structured exceptions should be
+ // hacked into TUT itself.
+ mycallback->test_completed(tut::test_result(
+ mycallback->mGroup,
+ mycallback->mGroupTests+1, // test within group
+ "unknown", // test name
+ tut::test_result::ex, // result: exception
+ // we don't have to throw this exception subclass to use it to
+ // populate the test_result struct
+ Windows_SEH_exception(msg)));
+ // we've left the TUT framework -- finish up by hand
+ mycallback->group_completed(mycallback->mGroup);
+ mycallback->run_completed();
+ });
bool success = (mycallback->getFailedTests() == 0);
diff --git a/scripts/perf/profile_cmp.py b/scripts/perf/profile_cmp.py
index 9dbfa3145b..34281b8d01 100644
--- a/scripts/perf/profile_cmp.py
+++ b/scripts/perf/profile_cmp.py
@@ -60,8 +60,9 @@ def compare(baseline, test, epsilon=DEFAULT_EPSILON):
if abs(delta) > epsilon:
deltas.append((delta, shader, bthruput, tthruput))
- # descending order of performance gain
- deltas.sort(reverse=True)
+ # ascending order of performance gain: put the most egregious performance
+ # hits at the top of the list
+ deltas.sort()
print(f'{len(deltas)} shaders showed nontrivial performance differences '
'(millon samples/sec):')
namelen = max(len(s[1]) for s in deltas) if deltas else 0