Commit graph

1367 commits

Author SHA1 Message Date
lawnjelly
5c8f497a24 Add project settings to manually specify API usage
As a result of the GLES specifications being vague about best practice for how buffers should be used dynamically, different GPUs / platforms appear to have different preferences.

Mac in particular seems to have a number of problems in this area, and none of the rendering team uses Macs. So far we have relied on guesswork to choose the best usage, but in an attempt to pin this down, this PR begins to introduce manual selection of options for users to test their configurations.
2020-10-31 18:33:55 +00:00
Rémi Verschelde
c43b2ab603
Merge pull request #42942 from Calinou/add-viewport-debanding-3.2
Add a debanding property to Viewport for GLES3
2020-10-30 11:47:57 +01:00
Rémi Verschelde
2e073ecbea
Merge pull request #42927 from lawnjelly/octree_default
Change render octree balance default
2020-10-21 10:19:34 +02:00
Hugo Locurcio
2dbc329704
Add a debanding property to Viewport for GLES3
It can be enabled in the Project Settings
(`rendering/quality/filters/use_debanding`). It's disabled
by default as it has a small performance impact and can make
PNG screenshots much larger (due to how dithering works).

As a result, it should be enabled only when banding is noticeable enough.

Since debanding requires a HDR viewport to work, it's only supported
in the GLES3 backend.
2020-10-20 19:07:15 +02:00
Hugo Locurcio
af45c97652
Add fast approximate antialiasing (FXAA) to Viewport
This backports FXAA from the `master` branch.

Co-authored-by: Clay John <claynjohn@gmail.com>
2020-10-20 14:54:52 +02:00
lawnjelly
10cdfda894 Change render octree balance default
Another bug in the octree has been discovered which can cause flickering in rare circumstances : #42895

For safety until this is fixed properly this PR reverts the default state of the octree to match the old behaviour, which doesn't appear exhibit the bug (or at least not as readily).
2020-10-20 08:49:52 +01:00
Rémi Verschelde
a239894827
Merge pull request #42902 from akien-mga/3.2-cherrypicks
Cherry-picks for the 3.2 branch (future 3.2.4) - 5th batch
2020-10-19 22:14:05 +02:00
Juan Linietsky
388ebfb498
Merge pull request #41629 from JFonS/disable_baked_lights
Disable lights for objects with baked lighting
2020-10-19 14:12:50 -03:00
Pedro J. Estébanez
aea87e9353
Fix application of window in FFT
(cherry picked from commit 257ba4a7fb)
2020-10-19 16:10:00 +02:00
lawnjelly
c2290dbedd Unified GLES2 / GLES3 Batching
Batching is mostly separated into a common template which can be used with multiple backends (GLES2 and GLES3 here). Only necessary specifics are in the backend files.

Batching is extended to cover more primitives.
2020-10-16 10:34:47 +01:00
JFonS
fcb00ca048 Disable lights for objects with baked lighting
Don't apply lighting to objects when they have a lightmap texture and
the light is set to BAKE_ALL. This prevents applying the same direct
light twice on the same object and makes setting up scenes with mixed
lighting much easier.
2020-10-11 20:41:40 +02:00
PouleyKetchoupp
f9544716f4 Option for software skinning in MeshInstance
Option in MeshInstance to enable software skinning, in order to test
against the current USE_SKELETON_SOFTWARE path which causes problems
with bad performance.

Co-authored-by: lawnjelly <lawnjelly@gmail.com>
2020-10-08 16:14:55 +02:00
Marcel Admiraal
6c4a02479d
Fix how Line2D obtains the other object's supports
Measure the distance from the line against the rotated object, not the
rotated line, when obtaining the object's supports against a line.

(cherry picked from commit 7e44682c03)
2020-10-04 20:54:35 +02:00
Rémi Verschelde
0845fbb51b
Merge pull request #32475 from lawnjelly/hideshadow
Showing and hiding geometry updates shadows (3.2)
2020-10-02 11:39:47 +02:00
Rémi Verschelde
66cbcc1b7e
Merge pull request #41123 from lawnjelly/octree_fix
Optimize octree and fix leak
2020-09-30 23:11:31 +02:00
John Pennycook
f8cc7893d0
Make YSort stable
Keeps track of the order in which items are collected by
_collect_ysort_children, and uses that order to break
ties between items with similar Y positions.

(cherry picked from commit 8d3afa985b)
2020-09-29 13:57:57 +02:00
Fabio Alessandrelli
6dffc1ef46
Ignore thread models when compiling with NO_THREAD
The thread model option for physics (2D) and rendering (single-unsafe,
single-safe, multithread), was causing crashes/locks when set as
multithreaded and exported for a platform that does not support threads
(namely HTML5).

This commit ensures that when threads support is not available, that
option is ignored, and the equivalent of "single-unsafe" is always used
instead.

(cherry picked from commit f3c6ac1d71)
2020-09-24 14:43:08 +02:00
Keegan Owsley
777d90d7a1
Wrap angles to (-pi, pi) in momentum calculation.
Fixes a bug that causes KinematicBody2Ds to produce too much angular
momentum when rotating beyond 180 degrees.

(cherry picked from commit e148338d42)
2020-09-24 14:43:06 +02:00
Markus Sauermann
d2636cd30f
Wake up RigidBody 2D after applying torque
(cherry picked from commit 8335f00949)
2020-09-24 14:43:05 +02:00
Rémi Verschelde
c8859f0463
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2020-09-18 14:09:51 +02:00
Fredia Huya-Kouadio
0af5cded1e Fix the update logic for user-added custom defines.
The previous logic was causing the (unintentional) removal of custom defines automatically added by the engine.
2020-09-06 21:31:09 -07:00
lawnjelly
667c970b77 Optimize octree and fix octree leak
Prevents adding new octants until a limiting number of elements have been added to the current octant. This enables balancing the benefits of brute force against the benefits of spatial partitioning. The limit can be set per octree.

Project settings are added for rendering octree to set the best balance per project depending on number of tests per frame / tick, and the amount of editing of the octree.

Fixes octants being leaked when removing elements.

Optimize octree with cached linear lists

Storing elements in octants using linked lists is efficient for housekeeping but very slow for testing. This optimization stores additional local_vectors with Element pointers and AABBs which are cached and only updated when a dirty flag is set on the octant.

This is selectable with 2 versions of Octree : Octree and Octree_CL, Octree being the old behaviour. At present the cached list version is only used for the visual server octree (rendering) as it has only been demonstrated to be faster there so far.

This uses slightly more memory (probably a few kb in most cases) but can be significantly faster during testing (culling etc).

Co-authored-by: Sergey Minakov <naithar@icloud.com>
2020-08-18 11:02:21 +01:00
clayjohn
8571f7b041 Check arrays before generating Polygon2D AABBs 2020-08-16 21:08:52 -07:00
Rémi Verschelde
f4d6830949
Merge pull request #40869 from clayjohn/3.2-polygon-aabb
Properly calculate polygon2D AABB with skeleton
2020-07-31 12:55:47 +02:00
clayjohn
32928c2112 Properly calculate polygon2D AABB with skeleton 2020-07-30 16:40:05 -07:00
Holger Dammertz
efe6b50f17 Added option to enable high precision float in GLES2
An additional project setting under rendering/gles2/compatibility with the name
enable_high_float.Android is introduced that enables #define USE_HIGHP_PRECISION
in GLES2 shader on Android when it is supported by the shader compiler.
This fixes #33633 and #32813 and also https://github.com/GodotVR/godot_oculus_mobile/issues/60
and https://github.com/GodotVR/godot_oculus_mobile/issues/68 on devices that
support the highp (high precision) modifier.
2020-07-30 05:40:15 +02:00
Rémi Verschelde
400a780050 Revert "Allow Area2D and 3D mouse events without a collision layer"
This reverts commit 15850687a8.
2020-07-27 22:46:04 +02:00
Juan Linietsky
ceeb690476 Properly pass safe margin on initialization.
Fixes jitter.

(cherry picked from commit 13e0385702)
2020-07-15 12:48:18 +02:00
Rémi Verschelde
d2be483e96
Merge pull request #40406 from Chaosus/fix_shader_3.2
[3.2] Fix some incorrect conversions which lead to crash in shaders
2020-07-15 09:13:41 +02:00
Yuri Roubinsky
ecd54630ef [3.2] Fix some incorrect conversions which lead to crash in shaders 2020-07-15 06:36:24 +03:00
Tomasz Chabora
15850687a8 Allow Area2D and 3D mouse events without a collision layer
Co-authored-by:    Tomasz Chabora <kobewi4e@gmail.com>
2020-07-11 11:14:12 +01:00
Marcel Admiraal
ccdfaf2491 Remove elements from monitored_bodies and monitored_areas as they are
processed before calling the callback, instead of after they have all
been processed, because the callbacks may readd them.
2020-07-04 10:08:33 +01:00
Cevantime
6206f4439d fix laxist collision detection on one way shapes
(cherry picked from commit 23f7d2c29d)
2020-07-03 15:34:30 +02:00
Fabio Alessandrelli
d06ad40757 Add default 50ms output_latency web override.
Hopefully a good tradeoff between latency and performance on most
browsers.
2020-07-02 14:30:23 +02:00
Rémi Verschelde
63fd0d37ed
Merge pull request #39895 from madmiraal/fix-39768-3.2
[3.2] Trigger broadphase update when changing collision layer/mask.
2020-06-29 21:34:56 +02:00
Marcel Admiraal
de284ea5d2 Trigger broadphase update when changing collision layer/mask, and
check for collision layer/mask changes in 2D hash grid broadphase update.
2020-06-27 18:11:21 +01:00
Yuri Roubinsky
891b84a833 [3.2] Prevents usage of return in main shader functions 2020-06-27 17:38:22 +03:00
Yuri Roubinsky
474b178534 [3.2] Fix shader crash if pass const argument to 'out/inout' parameter 2020-06-25 10:27:37 +03:00
Marcel Admiraal
b006f5402d Check for motion in cast_motion() before doing Bullet convexSweepTest().
Also ensure that default closest_safe and closest_unsafe values are
defined in cast_motion() and before cast_motion() is called.
2020-06-21 16:28:01 +01:00
Ev1lbl0w
17c87d2ec1
Expose disable_render_loop property to GDScript 2020-06-18 11:59:29 +01:00
Marcel Admiraal
a48e13101d Ensure pair callback data is set to null when it's null. 2020-06-13 14:37:40 +01:00
Rémi Verschelde
3fb9c776ff
Merge pull request #39437 from akien-mga/3.2-cherrypicks
Cherry-picks for the 3.2 branch (future 3.2.2) - 8th batch
2020-06-10 17:33:50 +02:00
Rémi Verschelde
3c7e03510c
Merge pull request #39256 from lawnjelly/tilemap_pixel2
GLES2 batching - Add UV precision adjustment for tilemaps
2020-06-10 15:52:00 +02:00
Rémi Verschelde
7bf9787921 SCons: Format buildsystem files with psf/black
Configured for a max line length of 120 characters.

psf/black is very opinionated and purposely doesn't leave much room for
configuration. The output is mostly OK so that should be fine for us,
but some things worth noting:

- Manually wrapped strings will be reflowed, so by using a line length
  of 120 for the sake of preserving readability for our long command
  calls, it also means that some manually wrapped strings are back on
  the same line and should be manually merged again.

- Code generators using string concatenation extensively look awful,
  since black puts each operand on a single line. We need to refactor
  these generators to use more pythonic string formatting, for which
  many options are available (`%`, `format` or f-strings).

- CI checks and a pre-commit hook will be added to ensure that future
  buildsystem changes are well-formatted.

(cherry picked from commit cd4e46ee65)
2020-06-10 15:30:52 +02:00
Rémi Verschelde
c9a8309e73
Merge pull request #39169 from lawnjelly/light2d_layer_fix
3.2 Make Light2D respect CanvasLayer layer_min and layer_max
2020-06-10 13:35:37 +02:00
Rémi Verschelde
9901eac9f5
Merge pull request #39400 from madmiraal/fix-39374-3.2
[3.2] Test collision mask before creating constraint pair in Godot physics broadphase 2D and 3D.
2020-06-09 13:38:11 +02:00
Marcel Admiraal
5794a4e11e Test collision mask before creating constraint pair in Godot physics
broadphase 2D and 3D.
2020-06-08 17:43:41 +01:00
lawnjelly
1b5c4bc5b7 Make Light2D respect CanvasLayer layer_min and layer_max
As the masked light list takes no account of layer_min and layer_max, the canvas_layed_id is passed to the _light_mask_canvas_items function where it can be used to reject lights outside the layer range.
2020-06-08 05:41:18 +01:00
lawnjelly
275183ef15 GLES2 batching - Add UV precision adjustment for tilemaps
Scaling tilemaps can cause border artifacts around the edges of tiles. This has been traced to precision issues in the GPU. This PR adds an adjustment to allow a minor contraction of the UVs of rects in order to compensate for the incorrect classification of texels across the UV border.
2020-06-07 16:29:40 +01:00
Rémi Verschelde
6e1af78df4
Merge pull request #39068 from lawnjelly/kessel_settings_rename
Rename batching project settings in preparation for GLES3
2020-06-07 14:25:50 +02:00