Commit Graph

1597 Commits (8a2e77d035ebe1ec9ab4c5a67e4792d002ae4aca)

Author SHA1 Message Date
whitequark d857e3e9cd Various header cleanups. NFC.
* Don't use a reserved identifier in include guards.
  * Use fabs() from <cmath> instead of our own ffabs().
    This shouldn't make any difference with modern toolchains.
  * Convert a few preprocessor macros to constexprs.
2020-05-10 09:24:12 +00:00
whitequark e00d4867e1 Refactor dbp. NFC.
After this commit, dbp() is renamed to DebugPrint() and moved to
platform.cpp, next to other similar functions. The existing short
name is provided by a preprocessor macro, similar to ssassert().

This leaves just the (rather hacky) temporary heap in util*.cpp.
2020-05-10 08:54:12 +00:00
whitequark 9951da8965 macOS: ignore spurious `-psn_` command line argument.
Fixes #602.
2020-05-10 08:30:01 +00:00
whitequark 1442ee5ec3 Refactor InitPlatform.
This commit performs three related cleanups:
  * The slvs library no longer uses explicit platform initialization
    (which drags in the side effects of InitPlatform that are not
    desirable in a library). Instead, it just ensures that it has
    the temporary heap, which is what it was callingInitPlatform for.
  * InitPlatform is simplified and moved to platform.cpp, next to
    other path related functions.
  * InitPlatform is renamed to InitCli and is called from InitGui
    implementations. GUI toolkits sometimes have options they use
    internally (that's the case for for GTK and Cocoa at least),
    and we shouldn't try to parse those as a file to open.
2020-05-10 08:29:25 +00:00
whitequark 9c1804b1b5 Get rid of MemAlloc/MemFree.
After commit 521473ee there's no point in keeping these around.
Instead, use the same heap in containers as the C++ standard library.
2020-05-10 06:11:53 +00:00
whitequark 521473ee4b Win32: use CRT heap instead of our own.
Historically SolveSpace used its own heap on Windows since it gave
better control and debugging options, but a lot of development these
days happens on Linux, where that heap was a stub around malloc/free,
and also Windows debugging tools got a lot better.

In terms of immediate benefit, this commit fixes heap corruption
on Windows introduced in commits b4e1ce44 and 47e82798, caused
by allocating with HEAP_NO_SERIALIZE in parallel from OpenMP threads.
Without HEAP_NO_SERIALIZE there's no performance benefit to keeping
our own heap, either.

The vl() function is also removed because for development there are
better tools now, and the only place where it was permanently called
from became a no-op, since temporary heap always validates after
FreeAllTemporary() recreates it.
2020-05-10 05:35:42 +00:00
whitequark 74103eee81 CMake: expand sanitizer support to include TSan. 2020-05-10 02:52:39 +00:00
whitequark 47e82798da CMake: detect OpenMP and use if available.
This is a missing part of commit b4e1ce44.
2020-05-09 19:46:16 +00:00
phkahler b4e1ce44e8 Use OpenMP for triangulation 2020-05-09 13:54:52 -04:00
phkahler 7baf58588b No message if cached points to don't converge. Quiet the terminal. 2020-05-08 22:18:30 -04:00
phkahler a7e0a174e3 Don't create redundant edges in UvGridTriangulate into. 2020-05-08 13:24:36 -04:00
ruevs 05aa649508 Update changelog 2020-05-08 11:27:08 +00:00
phkahler a52d88bc3d Less work in AssembleContour 2020-05-06 18:38:58 -04:00
phkahler 88a0e55f35 Eliminate infinite loop AssemblePolygon 2020-05-06 18:38:58 -04:00
phkahler 7366a6c53d
Bernstein polynomials with no branching. (#591) 2020-05-02 14:56:50 -04:00
Maximilian Federle 76b3efbd08 Travis: allow Snap arm64 to fail
arm64 builds on Travis are not yet fully mature and this
causes a high failure rate that is not caused by our code.

Continue building and deploying arm64 to the edge channel,
but don't consider the result for the success of the whole
build job.

Alleviates #587
2020-04-27 20:00:07 +00:00
whitequark 35448298bc README: update Linux-to-Windows cross-compilation instructions. 2020-04-27 17:23:55 +00:00
phkahler f36ac500a1
Add rotated face from point entity type. Fixes issue 585, problems constraining to Revolve and Helix ends. (#586) 2020-04-24 17:37:55 -04:00
phkahler 700b5d6719
Allow Revolve and Helix end surface selection and constraints. (#584) 2020-04-22 19:55:18 -04:00
phkahler 45eb246865
Eliminate some entity copies in lathe groups. Eliminates a crash due to copy numbers going over 1000. May break some older files with constaints on lathed entities. (#582) 2020-04-21 00:44:27 -04:00
phkahler b55dac7620
Don't create extra copies of entities in Revolve and Helix groups.
Might break some older files with those groups that depend on these
extra entities.

Fixes #549.
2020-04-21 01:24:33 +00:00
Ryan Pavlik e51fdf6fba Use handles instead of pointers in GenerateAll(). NFC. 2020-04-20 18:37:03 +00:00
Maximilian Federle f5415b3fe6 snap: Upgrade from gnome-3-28 extension to gnome-3-34
Using gnome-3-34 gives us a newer stack in general
and also provides us with a sdk build-snap, so we don't need
to specify as many build-packages and stage-packages.

This makes the snap slimmer and delegates the responsibility
for security updates to the gnome platform snap for even more
packages.
2020-04-17 09:17:53 +00:00
Maximilian Federle 13b461d750 snap: Use symlink instead of bind-mount for layout
As per https://snapcraft.io/docs/snap-layouts,
bind-mounts significantly increase the startup time of the snap.
Use symlink instead for better performance.
2020-04-16 18:56:13 +00:00
Tim 72635df56e
Add menu options for line styles / view / configuration.
This is to make them a bit easier to find, since the natural place
to look for config options is somewhere like File->Preferences or
Edit->Settings.
2020-04-01 21:25:18 +00:00
Tim 647171017a
Fix more segfaults in mouse.cpp lambdas (#574)
This changes all the lambdas to have explicit captures, since the use of
implicit captures has led to some memory errors, especially segfaults in
the right-click menu.

I'm not 100% sure that the code is correct anyway - it really needs auditing
to ensure all referenced values are still valid when the menu item is clicked
(e.g. can you change stuff with keyboard shortcuts while the context menu is
visible?), but it should at least be *more* correct!
2020-03-29 01:46:34 +00:00
Tim 485fd012b4
Fix segfault in Remove Spline Point context menu
This was incorrectly capturing `r` by reference and using it after it left
its scope. Changed to  capture by value, and also explicitly capture `this`
in case we were accidentally capturing any other scope variables by reference.

Fixes #571
2020-03-28 15:28:12 +00:00
phkahler f7b6f6930e
Nurbs (#473)
* Limit u,v range between 0 and 1 in Newton. Fixes issue #471
* Change the math for projecting a point onto a plane to work better with non-orthogonal U,V derivatives in several places. Fixes #472.
2020-03-27 15:40:58 -04:00
phkahler 83b0402c84
Added developer instructions for creating new entity transformations in the solver. (#491) 2020-03-27 15:08:35 -04:00
nabijaczleweli 645353cbdc Force SSE2 floats for i686 targets
Both GCC and Clang use x87 instructions by default on 32-bit x86
targets, but the loss of precision resulting from that has yielded
crashing tests (see referenced issue), and it can be safely assumed
there are very few CPUs that both don't support SSE2 and are expected to
run SolveSpace

This commit also removes a now-redundant check for 32-bit Windows
against TARGET, which doesn't seem to be actually set by CMake at all

Ref: #565
2020-03-24 17:31:21 +00:00
nabijaczleweli aeaece53e1 Accept both slashes in test harness on Win32
This fixes tests when __FILE__ produces output separated with / instead
of \, like on my Windows+MSYS2+GCC config

Fixes #563
2020-03-23 01:07:40 +00:00
nabijaczleweli e355a095c4 Force vendor zlib, png, and FreeType on Win32, too
This has lead to linker problems if the environment does have standard
versions of zlib/png (like from MSYS2), see discussion in referenced
issue

Closes #559
2020-03-15 03:03:24 +00:00
nabijaczleweli 7e33d2daec Update ANGLE to 8776e911bf71f68518ddd1995ce09d80db8c1216 2020-03-15 03:03:24 +00:00
Roc a6c34bb44d
Fix a crash when trying to show an error with bad separator.
For example, a single dot or colon at the end of the error string.
2020-03-12 23:03:26 +00:00
nabijaczleweli 6017ecdacc Fix two trivial implicit double to int conversion warnings. NFC 2020-03-08 16:33:55 +00:00
nabijaczleweli c29624f4a1 Update flatbuffers, fixing build on Clang trunk
flatbuffers hard-code general -Werror, which led to builds failing on
clang 11.0.0-++20200307120047+01c48d7d11e-1~exp1~20200307110643.632
with a plethora of
 ../extlib/flatbuffers/include/flatbuffers/flatbuffers.h:1720:25:
 error: definition of implicit copy constructor for
 'TableKeyComparator<reflection::Object>' is deprecated because it has
  a user-declared copy assignment operator [-Werror,-Wdeprecated-copy]
2020-03-08 16:33:38 +00:00
ruevs fcb2757d5d Win32: Drastically reduce stack usage at startup. NFC?
See:
https://github.com/solvespace/solvespace/issues/92#issuecomment-567831112

The problem was first introduced here:
dabd57847e

and later "fixed" here:
f324477dd0
by setting the stack size to /STACK:33554432

Solvespace now starts up even with /STACK:554432

According to this:
https://en.cppreference.com/w/cpp/language/value_initialization
```
"2) if T is a class type with a default constructor that is neither user-provided nor deleted (that is, it may be a class with an implicitly-defined or defaulted default constructor), the object is zero-initialized and then it is default-initialized if it has a non-trivial default constructor; "
```
So removing the `{}` should leave both the `System` and `TextWindow` class instances properly initialized.
2020-02-24 08:41:45 +00:00
ruevs 8ef3cacc33 Fix a bug with 3Dconnexion: SpaceMouse
A warning found with /W4 by MSVC 2019 (Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28314)
is an actual bug. How does the SpaceMouse (I do not have one) work at all when the global `hSpaceWareDriverClass` is NULL?!

.\src\platform\guiwin.cpp(1392,34): warning C4459: declaration of 'hSpaceWareDriverClass' hides global declaration
.\src\platform\guiwin.cpp(1389,13): message : see declaration of 'SolveSpace::Platform::hSpaceWareDriverClass'
2020-02-20 14:03:31 +00:00
ruevs f6a774d7bf Fix some trivial warnings found by MSVC. NFC.
Found with /W4 by MSVC 2019 (Microsoft (R) C/C++ Optimizing Compiler Version 19.24.28314)

A bunch of implicit casts 'double' to 'float' and one 'int64_t' to 'unsigned'.

.\src\platform\guiwin.cpp(1237): warning C4701: potentially uninitialized local variable 'cursorName' used
.\src\platform\guiwin.cpp(1237): warning C4703: potentially uninitialized local pointer variable 'cursorName' used

.\src\solvespace.cpp(805,30): warning C4456: declaration of 'gs' hides previous local declaration
.\src\solvespace.cpp(715,17): message : see declaration of 'gs'

.\src\solvespace.cpp(849,47): warning C4456: declaration of 'e' hides previous local declaration
.\src\solvespace.cpp(847,29): message : see declaration of 'e'

.\src\render\render.h(288,51): warning C4458: declaration of 'camera' hides class member
.\src\render\render.h(271,17): message : see declaration of 'SolveSpace::SurfaceRenderer::camera'

.\src\render\render.h(289,57): warning C4458: declaration of 'lighting' hides class member
.\src\render\render.h(272,17): message : see declaration of 'SolveSpace::SurfaceRenderer::lighting'
2020-02-20 14:03:31 +00:00
Maximilian Federle bae84b27e4 snap: Fix missing extension for cli
solvespace-cli needs the gnome-3-28 extension to find its libraries.
2020-02-14 10:01:51 +00:00
Maximilian Federle 1cd727d9dc snap: Remove superfluous files from package
Remove all files from snap that are already included in the base snap
or in any connected content snaps.

The main advantage is the massively reduced snap size:
From ~70 MB down to ~6 MB.
2020-02-14 10:01:51 +00:00
Maximilian Federle dcc80de730 snap: Add missing sudo in Travis deploy step
Running the build step with sudo necessitates running the deploy step with sudo too.
Otherwise, we face permission problems.
2020-02-08 16:50:55 +00:00
Maximilian Federle 65ab59503a snap: Build snaps on Travis without remote-build & drop i386 + armhf
Snapcraft's remote-build does not fit the requirements of CI,
so replace it with builds running directly on Travis:

1. Builds on Travis can run independently, whereas remote-build
competes for the same resource (Launchpad) and will potentially
block if multiple commits require building in succession.
2. Snapcrafts CLI for remote-build is not designed to be easily
scriptable.
3. Travis recently introduced building on arm64, so builds for
arm64 are now very fast and don't require emulation.

We do not build for armhf and i386 any more because they are
of little relevance on the desktop.
2020-02-08 16:15:09 +00:00
Koen Schmeets 3ed1719de2
Fix immediate editing of reference constraints.
Before this commit, if immediate editing of constraints was enabled,
then when adding a reference constraint, an editor was incorrectly
opened.
2020-02-05 05:34:33 +00:00
Maximilian Federle 72bc71cc9d README: add snap as an installation option. 2020-01-23 17:05:13 +00:00
Maximilian Federle 2dcd81d7e7 snap: Release snaps to store via script instead of snap provider
dpl-snap only supports pushing one snap at a time.
Instead of many repetitive deploy statements,
we use our own script to loop over the snaps to be released.
2020-01-23 01:47:10 +00:00
Maximilian Federle d5351c48e3 snap: build snaps on Travis via remote-build.
We invoke builds on Launchpad in stage "deploy" and release it into
the edge channel of the Snap Store.

The deploy stage is blocked on fails of the test stage, so we don't
release snaps with failing tests.
2020-01-21 23:38:55 +00:00
ruevs 16c5fa6889 Fix eight trivial "implicit conversion 'double' to 'int'" warnings. NFC. 2019-12-17 19:35:44 +00:00
whitequark 64c0f62b92 Win32: mark all remaining functions as Unicode. NFC.
Some were missing the *W suffix.
2019-12-06 15:21:51 +00:00
whitequark 69baf52432 Linux: fix Z-order in scalable icon. 2019-12-04 13:57:10 +00:00