Commit Graph

5886 Commits

Author SHA1 Message Date
James Turner
f74ba148ab Precomputed random numbers API
Use precomputed tables to give stable random numbers : replaces previous
recompuation when we exhaust the RNG pool.

By Marc Eberhard
2021-05-25 12:53:36 +01:00
Fernando García Liñán
e7fbf83155 Compositor: Allow changing the implicit buffer attachments 2021-05-24 23:49:45 +02:00
James Turner
26995ba13b Raise minimum OSG version to 3.6 2021-05-24 16:47:56 +01:00
James Turner
bd6a18bb96 CMake: set OpenGL VND policy to NEW to see if it works
OLD is causing shouty warnings from CMake, let’s see what happens if
we try for NEW.
2021-05-24 12:40:32 +01:00
James Turner
8d0d1f9047 Props changes: fix a link error with Clang 2021-05-24 12:40:32 +01:00
Stuart Buchanan
e91c06223a WS30: Reduce log spam
Previously blank lines in the various .txt LIST files
created spurious error logging.  This commit does some
simple length checking and ignore blank lines rather than
complaining (and then ignoring).
2021-05-23 21:25:16 +01:00
Julian Smith
0b6678f745 simgear/structure/SGSharedPtr.hxx: reformatted to make it readable. 2021-05-23 08:10:57 +01:00
Julian Smith
46e79aba11 simgear/math/simd4x4.hxx: avoid -Wdeprecated-copy warnings.
Added simd4x4_t::operator=().
2021-05-23 08:10:57 +01:00
Julian Smith
0f78bcaa49 simgear/props/props.*: various debugging/diagnostics additions to property locking.
Added runtime control of property locking active, and lock contention
diagnostics; new SGPropertyLockControl() allows associated property nodes to be
registered.

Added code to measure time spent locking/unlocking; disabled via preprocesor by
default because gives small decrease in fps even when disabled at runtime.

If SG_PROPS_UNTHREADSAFE is defined we defer to the old property code at build
time (requires old files to be available as props-unsafe.{hxx,cxx}). This
facility will hopefully be be removed at some point, but for now makes it
easier to compare before/after speed.
2021-05-23 08:06:02 +01:00
Julian Smith
f1dd7901cb simgear/props/props.*: added locking using read/write mutex.
Added a std::shared_mutex to SGPropertyNode and changed all props code to use
shared or exclusive locks as necessary whenever reading/writing data.

SG_PROPERTY_LOCKING=0 or 1 can be used to control whether locking is
active. Default is 1.

SG_PROPERTY_LOCKING_VERBOSE=0 or 1 can be used to cause diagnostics to be
generated if we get lock contention. Default is 0.

Removed most of the inline implementation code in props.hxx - now that we use
locking, nearly all calls eventually end up in props.cxx in order to take out
a lock so there's no point inlining. For template code this also means that we
now explicitly instantiate / specialise in props.cxx.

Reformateed props.hxx to use consistent indentation. Also condensed identical
comments for related methods such as getBoolValue(), getIntValue() etc, which
results in more readable visual grouping.

Much of the internal implementation code for SGPropertyNode is now in the form
of static methods in a new SGPropertyNodeImpl class in props.cxx. This class is
marked as a friend of SGPropertyNode in props.hxx so these methods can access
all SGPropertyNode internal data without being declared in props.hxx. So one
can change implementation code without recompiling everything.

Removed TEST_READ and TEST_WRITE macros.

Removed SGPropertyNode::MAX_STRING_LEN - was only used in compare_strings() and
it is unnecessary.
2021-05-22 23:52:36 +01:00
Fernando García Liñán
64e4adf0b9 Fix osgText issues under OSG 3.6
It looks like assigning an Effect to the geode containing the osgText is
enough and there aren't any conflicts with OSG own shaders. This might
change in the future if the switch to the core profile happens.

The text shaders also rely on fixed pipeline features like
gl_FrontColor. This is because aircraft developers are used to using
material animations to change the text color.
2021-05-14 22:47:28 +02:00
Stuart Buchanan
d0f4e9018c WS30: Fix regression of lakes
Fix regression that stopped lakes from being generated.
2021-05-12 21:36:11 +01:00
Stuart Buchanan
81b93cffbb WS30 - Minor roads and coastline improvements
- Correct normals on line features and coastlines
- Ignore coastline segments < 10m
- Clean up logging.
2021-05-08 20:46:38 +01:00
Stuart Buchanan
b6c4245b35 WS30: Don't compress landclass textures
Previously landclass textures were compressed by
out internal optimizer.  This caused bad artifacts
on landclass boundaries, e.g. where landclass 1 met
landclass 10 there would be compression/interpolation
artifact with a value of (say) 5.

This disables compression for such landclass textures.
2021-05-08 15:44:38 +01:00
James Turner
51bf76846c Thread-safe error reporting in lowlevel.cxx
Use an exception rather than polling a flag, for checking errors
during BTG reading. This should allow us to give a correctly
identified error, at exactly the point the read fails.
2021-05-03 16:22:24 +01:00
Stuart Buchanan
fc93788ab1 WS30: Initial coastlines 2021-05-03 15:43:59 +01:00
Richard Harrison
8464ef48e8 Fixes #2579 Emesary segfault on reset.
Need to call OnDeregister before the object is deleted (because not using smart pointers for receivers).
2021-05-02 17:35:24 +02:00
James Turner
5e30d83a43 Error-reporting: improve reports for STGs and effects
When an effect defines no shader sources, special case this error to
avoid confusing result from SGProgram.

Add error-context for readNode STG loading, so failures inside an
STG can be attributed
2021-04-30 13:47:34 +01:00
Fernando García Liñán
0299764619 Remove unsupported buffer format 2021-04-29 13:03:29 +02:00
Fernando García Liñán
ccebbc4bb3 Compositor: Move cull mask setter to a separate function 2021-04-29 12:29:35 +02:00
James Turner
fa40a6d1b8 Error reports: default to SG_LOG(SG_ALERT
When no callback is registered, just fall back to a plain SG_ALERT
2021-04-23 12:46:48 +01:00
James Turner
ede4484b8d Particles: guard against duplicate init 2021-04-23 12:46:20 +01:00
James Turner
2871a2df85 Effects: better error reporting 2021-04-21 21:55:04 +01:00
James Turner
d521625307 Asan: fix leaks in Catalog code 2021-04-21 21:54:45 +01:00
James Turner
1304624f30 ASan: fix a leak in GZ extraction 2021-04-21 21:53:56 +01:00
James Turner
83b58b68ae HTTP tests: fix an ASan warning. 2021-04-21 12:45:56 +01:00
James Turner
f9f5977cca NasalEmeserayInterface to an explicit pointer.
Also move to its own file, and give it a real header so it can be
directly initialised. (Requires corresponding FlightGear commit)
2021-04-21 12:45:42 +01:00
Richard Harrison
2690fadca1 Emesary IReceiver no longer shared ptr.
The use of SGShared for IReceiver derived conflicted with other uses of SGShared / SGReferenced - and after consideration transmitters should probably remain static for the lifetime of the application.

Any dynamic transmitters will need careful consideration if working in a threaded environment to ensure that a transmitter doesn't go out of scope before any notifications that it has issued have finished being processed by other threads.
2021-04-16 21:13:13 +02:00
Erik Hofman
41d06ee092 IReceivers are shared pointers now 2021-04-16 14:30:46 +02:00
Erik Hofman
c85f29c8d1 Converting a static variable into a shared_ptr is a bad idea, start with a shared_ptr from the start 2021-04-15 11:42:24 +02:00
Erik Hofman
e0d7a92eba Fix a bunch of compiler errors 2021-04-15 10:05:22 +02:00
Erik Hofman
93299bf191 Fix a compiler warning: not defining a virtual destructor results in undefined behavior 2021-04-15 10:05:05 +02:00
Erik Hofman
986867f5c5 Make size_t available 2021-04-15 10:04:00 +02:00
Erik Hofman
bcfff2a967 Bi-directional I/O using Data Distribution Services requires a separate reader and writer. 2021-04-15 09:45:17 +02:00
Richard Harrison
9b3265c46c Emesary: lock free performance improvements
After testing with multithreading there were still problems related to
scope and transmitters - because a transmitter that was on the stack
as an object could go out of scope before a notify all had finished
and lead to invalid data and a crash

The solution is to always have Recipients allocated via new() and to
use a shared pointer to manage the scope and garbage collect when the
last reference goes out of scope.

To achieve the threadsafe minimal locking the rules are as follows;

* All recipients must be allocated via new()
* Register and DeRegister will only happen when on the outermost
  level of NotifyAll.
 - all other add or delete will be put into the pending queue and
   added at the start of the next outer notify all
 - at outer level notify all a lock will be taken to process pending
   items
* during the main notify processing there will be no locks - however
  it is also assumed that the recipient list will not be changed
2021-04-11 00:42:49 +02:00
Richard Harrison
739c76e862 Win32 console; added method to ignore errors
This is mainly for standalone FGCOM - because the error message is always shown because it is a console app and --console isn't required.
2021-04-08 21:57:31 +02:00
Erik Hofman
9ae26d7f80 Get the GUID from DDS and store it for future use. Which coul be handy for point-to-point connections over DDS. 2021-04-07 11:51:32 +02:00
James Turner
89271e85a0 Shaders: report all shader file paths
When reporting a shader log error, include all the shader file
paths and the effect path in the detailed error information.
2021-04-05 12:06:55 +01:00
Erik Hofman
e4c214578b Allow parsing a DDS configuration file. Add a guard condition to wake up the waitset at exit. 2021-04-05 12:38:13 +02:00
Stuart Buchanan
769e00ffdf WS30: AREA_FEATURE_LIST STG verb - lakes, lochs
- Add and AREA_FEATURE_LIST STG verb.
- /sim/rendering/static-lod/area-features-lod-level to control point at
  which such feature are rendered
- /sim/rendering/static-lod/lod-leve[n]/area-features-min-width sets
  the minimum width for feature rendering at that LoD level.

STG Format:

AREA_FEATURE_LIST <file> <material>

File format:

Area Attrib A B C D lon0 lat0 lon1 lat1 lon2 lat2 lon3 lat4....

where:
 Area is the area of the feature in m^2
 Attrib is an integer attribute (currently unused)
 A, B, C, D are generic float attributes.  Their interpretation may vary by feature type
 lon[n], lat[n] are pairs of lon/lat defining straight road segments
2021-04-04 16:25:04 +01:00
James Turner
5f026c840c TerraSync: better reporting of permissions failures removing files
Log a ‘failed to remove orphan’ error as an error with the repository,
instead of failing the entire sync
2021-04-02 16:46:47 +01:00
James Turner
ae920c6ebd TerraSync: add a warning file to the root dir.
Try to discourage users from adding custom content underneath the
Terrasync dir, since it can be over-written.
2021-04-02 16:45:50 +01:00
James Turner
0343ef7246 Fix windows build, missing <algorithm> 2021-04-02 16:45:03 +01:00
Fernando García Liñán
00a6f02a55 Sort lights when we can only render a limited number of them
This ensures that higher priority lights and lights that are closer to the viewer get rendered.
2021-04-01 03:14:12 +02:00
Fernando García Liñán
eb761fc7ee Add compile_commands.json to .gitignore 2021-04-01 01:40:22 +02:00
Erik Hofman
9cb98475b2 Fix MingW and MSVC builds: return a uniform type name across platforms. 2021-03-29 16:08:06 +02:00
Erik Hofman
e58ca605b6 Delete the readers and writers (which closes them automatically) to prevent memory leaks. 2021-03-29 11:41:12 +02:00
Stuart Buchanan
deb802f74a WS30: Improve random vegetation, reduce frame paus
- Generate vegetation based on underlying landclass material mapping
- Reduce frame pauses by removing terrain init from update visitor
- Fix a couple of small timing windows causing crashes.
2021-03-28 19:50:26 +01:00
Erik Hofman
17c79caea3 Add a convenience constructor which uses the types typename to call setup, eliminating the need to call setup separately. 2021-03-28 08:57:37 +02:00
Erik Hofman
8e97b5e414 Add a helper function which converts the template typename into a topic name. 2021-03-27 15:21:22 +01:00