Commit graph

1759 commits

Author SHA1 Message Date
Rémi Verschelde
fdf58a5858 Rename InputFilter back to Input
It changed name as part of the DisplayServer and input refactoring
in #37317, with the rationale that input no longer goes through the
main loop, so the previous Input singleton now only does filtering.

But the gains in consistency are quite limited in the renaming, and
it breaks compatibility for all scripts and tutorials that access
the Input singleton via the scripting language. A temporary option
was suggested to keep the scripting singleton named `Input` even if
its type is `InputFilter`, but that adds inconsistency and breaks C#.

Fixes godotengine/godot-proposals#639.
Fixes #37319.
Fixes #37690.
2020-04-28 15:19:49 +02:00
bruvzg
2bb119c088
Fix "redefinition of 'ssr' with a different type" shader compile error. 2020-04-23 13:56:04 +03:00
Ignacio Roldán Etcheverry
5d29f42afa
Merge pull request #38116 from neikeq/index_buffer_create-defval
Fix missing DEFVAL for RenderingDevice.index_buffer_create
2020-04-22 17:30:23 +02:00
Ignacio Etcheverry
c5a721f58d Fix missing DEFVAL for RenderingDevice.index_buffer_create 2020-04-22 16:52:04 +02:00
muiroc
66ab577eb8 Register the DisplayServer Singleton 2020-04-21 22:04:12 +02:00
Juan Linietsky
f8ef38efed Add proper type to most public API uses of Array 2020-04-21 12:16:45 -03:00
Juan Linietsky
ae09b55a19 Exposed RenderingDevice to script API
Also added an easier way to load native GLSL shaders.

Extras:

Had to fix no-cache for subresources in resource loader, it was not properly working, making shaders not properly reload.

Note:

The precommit hooks are broken because they don't seem to support enums from one class being used in another.
Feel free to fix this after merging this PR.
2020-04-20 21:21:58 -03:00
Rémi Verschelde
2905367fed
Merge pull request #37970 from SkyLucilfer/ServerTypo
Correct typo mistake of profiler_add_frame_data argument in physics 3d server
2020-04-20 23:49:36 +02:00
Rémi Verschelde
9cf48b3e99
Merge pull request #38039 from akien-mga/docdata-skip-unexposed
DocData: Skip unexposed classes
2020-04-20 15:21:49 +02:00
Rémi Verschelde
0ef8bcac4d DocData: Skip unexposed classes
Properly expose classes that we actually want accessible.
2020-04-20 12:51:10 +02:00
Rémi Verschelde
b7b46093d8 doc: Sync classref with current source
Add missing enum bindings.
2020-04-20 11:48:00 +02:00
Rémi Verschelde
088c2a0870
Merge pull request #37947 from clayjohn/DOCS-rendering-update
Update many docs with recent rendering changes
2020-04-20 11:16:12 +02:00
Juan Linietsky
49d0c6a5c9 Ability to create local RenderingDevice instances. 2020-04-18 21:47:17 -03:00
SkyJJ
0991cdc975 Correct typo mistake of profiler_add_frame_data argument in physics 3d server 2020-04-17 21:56:25 +02:00
clayjohn
b50d954cb0 Update many docs with recent rendering changes 2020-04-17 09:47:59 -07:00
Rémi Verschelde
17304f1aae
Merge pull request #37949 from reduz/implement-global-shader-uniforms
Implement global and per instance shader uniforms.
2020-04-17 18:36:06 +02:00
Rémi Verschelde
cfda0e3770
Merge pull request #37953 from clayjohn/VULKAN-sky-sun-size
Add light size to Sky Shaders
2020-04-17 18:35:45 +02:00
clayjohn
7cd2ff309c Add light size to Sky Shaders 2020-04-17 09:32:24 -07:00
Juan Linietsky
0e1c66d9fc Implement global and per instance shader uniforms.
Adds two keywords to shader language for uniforms:
-'global'
-'instance'

This allows them to reference values outside the material.
2020-04-17 12:35:41 -03:00
clayjohn
0ff929a926 Use sky properly for ambient and reflections 2020-04-16 23:45:30 -07:00
Rémi Verschelde
4f2c1feab5
Merge pull request #37869 from madmiraal/fix-36533
Assign zero to range when ConvexPolygonShape2D is empty.
2020-04-16 11:39:18 +02:00
clayjohn
61d86190e0 Fix texture check in decal setup 2020-04-15 12:06:02 -07:00
Juan Linietsky
6f293ed795 Add support for projectors in spot and omni lights. 2020-04-14 17:05:45 -03:00
Rémi Verschelde
5e5103f460
Merge pull request #37861 from reduz/implement-decals
Implement decals
2020-04-14 17:13:20 +02:00
Juan Linietsky
5944eb6e7f Implement decals
Also implemented decal atlas, so projectors and other stuff can be added.
Sidenote: Had to make RID hashable, so some unrelated includes changed
in order to include it in hashfuncs.h
2020-04-14 11:13:34 -03:00
Marcel Admiraal
88d307df14 Assign zero to range when ConvexPolygonShape2D is empty. 2020-04-14 12:53:32 +01:00
Rémi Verschelde
e0eb9a8ae4
Merge pull request #37826 from nekomatata/direct-body-state-sleep
Fix set_sleep_state in Bullet body direct state
2020-04-14 12:53:20 +02:00
PouleyKetchoupp
30b184cb06 Fix set_sleep_state in Bullet body direct state
It was inverted, it should set the body to be active when sleep is disabled.
2020-04-14 11:39:34 +02:00
qarmin
88c0a9e3de Fixes leak with CopyToFbShaderRD 2020-04-13 11:39:44 +02:00
Rémi Verschelde
06748a2b5f
Merge pull request #37749 from clayjohn/Vulkan-improved-ss
Add vogel filter and settings to soft shadows
2020-04-13 00:39:37 +02:00
Juan Linietsky
a57dc398db Implement MSAA 2020-04-12 15:33:57 -03:00
Juan Linietsky
d160644c88
Merge pull request #37819 from reduz/implement-fxaa
Add screen space AA option, with FXAA implementation.
2020-04-12 11:46:14 -03:00
Juan Linietsky
16ae2cc1bf Add screen space AA option, with FXAA implementation. 2020-04-12 10:57:18 -03:00
Rémi Verschelde
1846d33b5f
Merge pull request #37822 from nekomatata/rigid-body-force-pos
Fix add_force in Godot Physics RigidBody
2020-04-12 11:46:22 +02:00
PouleyKetchoupp
4a0d15f91c Fix add_force in Godot Physics RigidBody
Now takes the center of mass into account for calculating the applied
torque, like apply_impulse does.
2020-04-12 11:20:32 +02:00
Juan Linietsky
9dc19f7619
Merge pull request #37808 from reduz/port-effects-to-compute
Moved most of the effect code to compute.
2020-04-11 23:38:05 -03:00
Juan Linietsky
d81911490b Moved most of the effect code to compute.
Simplifies it and improves performance.
Improves image barrier handling per mipmap on RenderingDeviceVulkan
2020-04-11 19:44:07 -03:00
Rémi Verschelde
636d4bad99
Merge pull request #37794 from clayjohn/VULKAN-SSS-sky
Fix SSS affecting Sky
2020-04-11 16:30:51 +02:00
Yuri Roubinsky
bc30f541e6 Fix shader constant sorting 2020-04-11 12:40:17 +03:00
clayjohn
e3a9af2db1 Fix SSS affecting Sky 2020-04-11 01:20:24 -07:00
clayjohn
621f6f09a8 Add proper quality settings to soft shadows 2020-04-10 23:09:17 -07:00
Juan Linietsky
d06f8ef75a Shows proper scene render time in editor info
Also fixed GPU profiler, which was not working on nvidia hardware.
2020-04-10 14:19:30 -03:00
Rémi Verschelde
1e5f0d402b
Merge pull request #37383 from WARIO-MDMA/godotphysics-rename
Rename "GodotPhysics" to "GodotPhysics{2D,3D}"
2020-04-10 12:39:26 +02:00
Rémi Verschelde
a152ef9a10
Merge pull request #37662 from qarmin/rasterizer_server_last
Free items before finishing rendering server
2020-04-10 11:50:13 +02:00
Rémi Verschelde
c2f0d58c36
Merge pull request #37722 from reduz/implement-softshadows
Support light size and soft shadows
2020-04-10 10:24:57 +02:00
Juan Linietsky
6a730ffeab Support light size and soft shadows 2020-04-09 15:11:15 -03:00
Bastiaan Olij
afc8c6391c Renaming all ARVR nodes to XR 2020-04-09 15:33:01 +10:00
Rémi Verschelde
23d786d6fb
Merge pull request #36919 from nekomatata/android-vulkan-rendering
Vulkan rendering support on Android
2020-04-09 00:16:26 +02:00
WARIO-MDMA
6d5c6ffbe0 Rename "GodotPhysics" to "GodotPhysics{2D,3D}" 2020-04-09 03:13:33 +10:00
Juan Linietsky
4ffc0d6b3f Refactored shadowmapping.
- Made shadow bias size independent, so it will remain when changing light or camera size.
- Implemented normal offset bias, which greatly enhances quality.
- Added transmission to subsurface scattering
- Reimplemented shadow filter modes

Closes #17260
2020-04-08 11:19:43 -03:00
PouleyKetchoupp
e167af3737 Display Server support 2020-04-08 01:47:09 +02:00
Hugo Locurcio
bcaf853767
Tweak rendering quality property hint strings for consistency
- Include a performance indication for all hints, not just for
  non-default values.
- Fix leading/trailing whitespace in some property hints.
2020-04-07 20:01:13 +02:00
qarmin
b5fd03fc36 Free items before finishing rendering server 2020-04-07 19:12:07 +02:00
qarmin
853f677c7e Fixed leak with SpecularMergeShaderRD 2020-04-04 17:48:30 +02:00
Juan Linietsky
c54f80d35c Re-implement subsurface scattering.
The size settings are more "just works", with default scale and depth scale
values that don't need much tweaking.

Additionally, a "skin" mode was added so skin looks better.
EDIT: Cleaned up SSR filter shader a bit.
2020-04-04 11:44:28 -03:00
Rémi Verschelde
aeb95ef006
Merge pull request #37438 from clayjohn/VULKAN-sky-invert
Invert Sky subpass cubemap z direction
2020-04-03 15:59:26 +02:00
Ignacio Etcheverry
27ddb27da8 Fix C# bindings after recent breaking changes 2020-04-03 01:38:48 +02:00
Rémi Verschelde
6a38ce1b31
Merge pull request #37512 from reduz/implement-ssr
Re-Added screen space reflection.
2020-04-02 17:17:27 +02:00
Juan Linietsky
87c658b304 Re-Added screen space reflection. 2020-04-02 11:25:21 -03:00
lupoDharkael
95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Rémi Verschelde
5f11e15571
Merge pull request #37504 from qarmin/out_of_bound_cursor
Fix array out of bounds access caused by uninitialised variables
2020-04-02 13:07:55 +02:00
Rafał Mikrut
359bebd8c0 Fix out of bound array access caused by unassigned variable 2020-04-01 19:29:35 +02:00
Rémi Verschelde
516b3bb88f Fix Clang warnings on Windows
Fixes #37490.
2020-04-01 16:28:20 +02:00
Rémi Verschelde
96e654335a
Merge pull request #37481 from ThakeeNathees/bind-method-typo
some typo in method binds fixed
2020-04-01 12:57:26 +02:00
Thakee Nathees
cb53b1d88e some typo in method binds fixed 2020-04-01 14:01:18 +05:30
Rémi Verschelde
0a2fa4d892 Fix more -Wmaybe-uninitialized warnings with target=release_debug
I have no idea why those don't get triggered in target=debug builds.

Fixes #37461.
2020-03-31 13:52:42 +02:00
Rémi Verschelde
e5033d3952 doc: Sync classref with DisplayServer/Window changes 2020-03-31 11:56:58 +02:00
Rémi Verschelde
f3c74afd28
Merge pull request #37436 from akien-mga/doc-node-renames
doc: Update classref with node renames
2020-03-30 20:32:11 +02:00
clayjohn
be9235e499 Invert subpass cubemap z direction 2020-03-30 10:42:45 -07:00
Rémi Verschelde
eaaee63b62 doc: Update classref with node renames
A few extra renames for classes which were missed in last week's PRs.
2020-03-30 18:23:02 +02:00
Juan Linietsky
89e1263117 Move glow upscale quality to a global setting, for consistency 2020-03-30 10:46:03 -03:00
Rémi Verschelde
cd4e46ee65 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.
2020-03-30 09:05:53 +02:00
Yuri Roubinsky
aa33db056a Prevent shader crash if multiple variables has been declared in 'for' 2020-03-28 19:51:42 +03:00
Rémi Verschelde
3f7fa93179
Merge pull request #37362 from reduz/audioserver-memory-cleanup
Remove the audio memory allocator, use regular one instead.
2020-03-28 15:49:48 +01:00
Rémi Verschelde
60d486acc8 Fix copyright headers for recently added files 2020-03-28 13:29:29 +01:00
Rémi Verschelde
0c320a6bf3 More server renames for consistency after #37361 2020-03-28 13:20:48 +01:00
Juan Linietsky
16245f2c29 Remove the audio memory allocator, use regular one instead. 2020-03-27 20:36:43 -03:00
Juan Linietsky
a6f3bc7c69 Renaming of servers for coherency.
VisualServer -> RenderingServer
PhysicsServer -> PhysicsServer3D
Physics2DServer -> PhysicsServer2D
NavigationServer -> NavigationServer3D
Navigation2DServer -> NavigationServer2D

Also renamed corresponding files.
2020-03-27 15:21:27 -03:00
Juan Linietsky
307b1b3a58
Merge pull request #37340 from reduz/rename-3d-nodes
Make 2D and 3D node names more explicit
2020-03-27 13:47:15 -03:00
Rémi Verschelde
d1acbbce7f Rename more 2D and 3D nodes to follow convention
Rename editor plugins to match the new node names.
2020-03-27 16:26:34 +01:00
Rémi Verschelde
f48aeeeeef
Merge pull request #37347 from akien-mga/displayserver-fix-create-func
DisplayServer: Fix registration of GetRenderingDriversFunction
2020-03-27 15:51:29 +01:00
Juan Linietsky
eaae4b6408 Renamed 2D and 3D nodes to make their types explicit
Fixes #30736.
2020-03-27 14:54:04 +01:00
Rémi Verschelde
f725bd99f4 Fix some -Wmaybe-uninitialized warnings
Namely:
```
modules/basis_universal/register_types.cpp: In function 'Ref<Image> basis_universal_unpacker(const Vector<unsigned char>&)':
modules/basis_universal/register_types.cpp:266:15: warning: 'imgfmt' may be used uninitialized in this function [-Wmaybe-uninitialized]
  266 |  image->create(info.m_width, info.m_height, info.m_total_levels > 1, imgfmt, gpudata);
      |  ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
modules/basis_universal/register_types.cpp:255:39: warning: 'format' may be used uninitialized in this function [-Wmaybe-uninitialized]
  255 |    bool ret = tr.transcode_image_level(ptr, size, 0, i, dst + ofs, level.m_total_blocks - i, format);
      |               ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

```
servers/visual_server.cpp: In member function 'Error VisualServer::_surface_set_data(Array, uint32_t, uint32_t*, uint32_t, Vector<unsigned char>&, int, Vector<unsigned char>&, int, AABB&, Vector<AABB>&)':
servers/visual_server.cpp:636:15: warning: 'iw' may be used uninitialized in this function [-Wmaybe-uninitialized]
  636 |       copymem(&iw[i * 2], &v, 2);
      |               ^
```

```
core/image.cpp: In member function 'Error Image::generate_mipmap_roughness(Image::RoughnessChannel, const Ref<Image>&)':
core/image.cpp:1683:11: warning: 'roughness' may be used uninitialized in this function [-Wmaybe-uninitialized]
 1683 |     float roughness;
      |           ^~~~~~~~~
```
2020-03-27 14:33:06 +01:00
Martin Liska
c554677c95
Fix various -Wmaybe-uninitialized (#37352). 2020-03-27 13:57:20 +01:00
Rémi Verschelde
fe3566e190 DisplayServer: Fix registration of GetRenderingDriversFunction
Also improve `--help` output.
2020-03-27 11:07:32 +01:00
bruvzg
15a9f94346 Add macOS DisplayServer implementation.
Change global menu to use Callable, add support for check items and submenus.
2020-03-26 16:24:05 +01:00
Juan Linietsky
197cb4e771 Fixes to X11, still pretty broken 2020-03-26 15:50:00 +01:00
Juan Linietsky
9a5d15a2dc Implemented drag and drop across windows, both OS and embedded. 2020-03-26 15:49:46 +01:00
Juan Linietsky
047e0b7de5 Reworked tooltips to use the popup system. 2020-03-26 15:49:45 +01:00
Juan Linietsky
b3080bc2f4 Popups have also been converted to windows
Controls using the old modal API have been replaced to use popups.
2020-03-26 15:49:44 +01:00
Juan Linietsky
c7b4dcae2f Open sub-windows as embedded if the OS does not support them 2020-03-26 15:49:43 +01:00
Juan Linietsky
543fb1c4da Separate DisplayServer from OS on Windows 2020-03-26 15:49:41 +01:00
Juan Linietsky
f51fdc6eef Support for transient windows 2020-03-26 15:49:39 +01:00
Juan Linietsky
8e6960a69e Refactored input, goes all via windows now.
Also renamed Input to InputFilter because all it does is filter events.
2020-03-26 15:49:39 +01:00
Juan Linietsky
9e08742de8 Added a Window node, and made it the scene root.
Still a lot of work to do.
2020-03-26 15:49:38 +01:00
Juan Linietsky
f8a79a97c7 Effective DisplayServer separation, rename X11 -> LinuxBSD 2020-03-26 15:49:34 +01:00
Juan Linietsky
4396e98834 Refactored Input, create DisplayServer and DisplayServerX11 2020-03-26 15:49:32 +01:00
bruvzg
1ee27a6d9f
Rename conflicting variable to fix MoltenVK shader compilation. 2020-03-26 09:02:36 +02:00
Rémi Verschelde
641c85a54f
Merge pull request #37268 from clayjohn/VULKAN-sky-color
Replace subpass textures with color in sky shader
2020-03-24 19:22:55 +01:00
clayjohn
61c67cd5e1 Replace subpass textures with color in sky shader 2020-03-24 10:11:00 -07:00
Rémi Verschelde
9d24541597 Remove unused classes and stray headers
Found by reviewing headers with 1 or less matching includes:
```
find -name thirdparty -prune -o -name "*.h" -exec basename {} \; | sort -u > headers
for header in $(cat headers); do echo "$header: "; rg -l "#include \"(.*/)?$header\"" | wc -l; done > list-includes
```
2020-03-24 09:50:51 +01:00
Rémi Verschelde
ed9a0d0484
Merge pull request #37179 from clayjohn/VULKAN-sky-shader
Implement Sky Shaders
2020-03-22 20:03:35 +01:00
clayjohn
61a74739ca Working sky shader implementation 2020-03-21 20:43:44 -07:00
Aaron Franke
7dbe8b65ae
Make file formatting comply with POSIX and Unix standards
UTF-8, LF, no BOM, and newlines at the end of files
2020-03-21 17:41:03 -04:00
Yuri Roubinsky
50729e4e35 Fix incorrect shader block parsing 2020-03-20 17:24:00 +03:00
Yuri Roubinsky
a757bd7625 Allow to reassign local variables in shaders 2020-03-20 14:09:43 +03:00
Bastiaan Olij
c3fee7ba6c Add shader based background mode 2020-03-19 18:30:39 -07:00
Yuri Roubinsky
523dae6bba Fix shader TIME auto-completion 2020-03-19 21:42:06 +03:00
Yuri Roubinsky
ef6320d82a Removed old TIME references from shader_types 2020-03-19 19:09:15 +03:00
Yuri Roubinsky
dbffa2e0bb Makes shader 'TIME' available in custom functions by default 2020-03-19 17:58:39 +03:00
Yuri Roubinsky
387d6859d7 Show shader method out/inout qualifier in intellisense 2020-03-18 16:06:47 +03:00
Yuri Roubinsky
4709434227 Fix shader crash if passing const values to modf function 2020-03-18 14:07:35 +03:00
Rémi Verschelde
cb282c6ef0 Style: Set clang-format Standard to Cpp11
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-17 07:36:24 +01:00
Yuri Roubinsky
7a2c6a8c0e Enables passing out built-in parameter from parent function in shaders 2020-03-14 10:46:27 +03:00
luz.paz
7bf6e5f773 Fix various typos
Found via `codespell`
2020-03-11 13:59:18 -04:00
Fabio Alessandrelli
b8ddaf9c33 Refactor ScriptDebugger.
EngineDebugger is the new interface to access the debugger.
It tries to be as agnostic as possible on the data that various
subsystems can expose.

It allows 2 types of interactions:

- Profilers:
  A subsystem can register a profiler, assigning it a unique name.
  That name can be used to activate the profiler or add data to it.
  The registered profiler can be composed of up to 3 functions:
    - Toggle: called when the profiler is activated/deactivated.
    - Add: called whenever data is added to the debugger
      (via `EngineDebugger::profiler_add_frame_data`)
    - Tick: called every frame (during idle), receives frame times.

- Captures: (Only relevant in remote debugger for now)
  A subsystem can register a capture, assigning it a unique name.
  When receiving a message, the remote debugger will check if it starts
  with `[prefix]:` and call the associated capture with name `prefix`.

Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new
profiler system.

Port SceneDebugger and RemoteDebugger to the new capture system.
The LocalDebugger also uses the new profiler system for scripts
profiling.
2020-03-08 12:36:39 +01:00
Rémi Verschelde
42595085a5
Merge pull request #36752 from RandomShaper/rework_semaphore
Drop old semaphore implementation
2020-03-05 16:33:45 +01:00
Rémi Verschelde
e89754fa1f
Merge pull request #36021 from YeldhamDev/intersects_touch_expose
Turn Rect2's 'intersects_touch()' into an extra argument of 'intersects()'
2020-03-04 20:32:20 +01:00
Rémi Verschelde
a0e33e17fb
Merge pull request #36733 from qarmin/static_analyzer_fixes
Fixes bugs found by Sonarcloud and Coverity
2020-03-04 13:41:38 +01:00
Michael Alexsander
8c8c48a7ad Turn Rect2's 'intersects_touch()' into an extra argument of 'intersects()' 2020-03-04 09:32:34 -03:00
Rémi Verschelde
2856740e6b
Merge pull request #36385 from kuruk-mm/some_static_asserts
Change when we can ERR_FAIL_COND and ERR_FAIL_CONV_V to static_assert
2020-03-04 13:18:48 +01:00
Bastiaan Olij
f0b1edef8b Exposing get_tracker_id for ARVRPositionalTracker to GDScript 2020-03-04 10:22:26 +01:00
Mateo Dev .59
c933eb7acc Change when we can ERR_FAIL_COND and ERR_FAIL_CONV_V to static_assert 2020-03-04 04:44:47 -03:00
Pedro J. Estébanez
9a3a2b03b8 Drop old semaphore implementation
- Removed platform-specific implementations.
- Now all semaphores are in-object, unless they need to be conditionally created.
- Similarly to `Mutex`, provided a dummy implementation for when `NO_THREADS` is defined.
- Similarly to `Mutex`, methods are made `const` for easy use in such contexts.
- Language bindings updated: `wait()` and `post()` are now `void`.
- Language bindings updated: `try_wait()` added.

Bonus:
- Rewritten the `#ifdef` in `mutex.h` to meet the code style.
2020-03-03 13:20:42 +01:00
Rémi Verschelde
c292aab247
Merge pull request #36691 from clayjohn/VULKAN-cubemap-roughness
Improve cubemap importance sampling
2020-03-02 19:32:19 +01:00
qarmin
1f209bfc41 Fixes bugs found by Sonarcloud and Coverity 2020-03-02 19:17:20 +01:00
clayjohn
a422b8c497 Properly free reflection probe atlas 2020-02-29 23:26:57 -08:00
clayjohn
6bb5117955 Improve cubemap importance sampling 2020-02-29 17:16:50 -08:00
Rémi Verschelde
93dd3d29d2
Merge pull request #36679 from clayjohn/VULKAN-mem-leak
Remove minimum size for shadow atlas
2020-02-29 23:32:16 +01:00
clayjohn
03d46ea804 Remove minimum size for shadow atlas 2020-02-29 10:09:15 -08:00
Yuri Roubinsky
924a9bfd16 Fix shader's step hint range for integers 2020-02-29 09:56:02 +03:00
clayjohn
74f6e3e1aa Reduce descripter sets in cubemap filter 2020-02-28 09:07:09 -08:00
Rémi Verschelde
4f64f3401a
Merge pull request #36388 from AndreaCatania/some_renames
Rename Navigation{Mesh,Polygon}Instance and PlaneShape for clarity
2020-02-28 09:15:38 +01:00
clayjohn
3e299aa225 Basic fast filtering implementation 2020-02-27 22:30:34 -08:00
Rémi Verschelde
a596d76156
Merge pull request #36627 from clayjohn/VULKAN-free
Properly free many Vulkan resources
2020-02-28 06:39:18 +01:00
Rémi Verschelde
b7b3978684
Merge pull request #36556 from RandomShaper/rework_mutex
Reimplement `Mutex` with C++'s `<mutex>` (plus more)
2020-02-28 00:26:01 +01:00
clayjohn
b616c728d7 Properly free many vulkan resources 2020-02-27 15:01:49 -08:00
Rémi Verschelde
3a7f1300ee
Merge pull request #36186 from Calinou/remove-vulkan-debugging-prints
Remove Vulkan debugging prints
2020-02-27 21:11:24 +01:00
Andrea Catania
3b64ecbc4b Renamed NavigationMeshInstance to NavigationRegion 2020-02-27 17:42:53 +01:00
Pedro J. Estébanez
18fbdbb456 Reimplement Mutex with C++'s <mutex>
Main:
- It's now implemented thanks to `<mutex>`. No more platform-specific implementations.
- `BinaryMutex` (non-recursive) is added, as an alternative for special cases.
- Doesn't need allocation/deallocation anymore. It can live in the stack and be part of other classes.
- Because of that, it's methods are now `const` and the inner mutex is `mutable` so it can be easily used in `const` contexts.
- A no-op implementation is provided if `NO_THREADS` is defined. No more need to add `#ifdef NO_THREADS` just for this.
- `MutexLock` now takes a reference. At this point the cases of null `Mutex`es are rare. If you ever need that, just don't use `MutexLock`.
- Thread-safe utilities are therefore simpler now.

Misc.:
- `ScopedMutexLock` is dropped and replaced by `MutexLock`, because they were pretty much the same.
- Every case of lock, do-something, unlock is replaced by `MutexLock` (complex cases where it's not straightfoward are kept as as explicit lock and unlock).
- `ShaderRD` contained an `std::mutex`, which has been replaced by `Mutex`.
2020-02-26 20:40:10 +01:00
Rémi Verschelde
be4a516b77
Merge pull request #36428 from clayjohn/VULKAN-ref-probe-sky
Properly flip sky when rendering reflection probes
2020-02-26 18:59:50 +01:00
Rémi Verschelde
3a4c128f07
Merge pull request #36551 from AndreaCatania/navigation_destruction_flush
Flushes commands just before the navigation server is destroyed
2020-02-26 10:09:43 +01:00
Andrea Catania
c143b5c677 Flushes commands just before the navigation server is destroyed 2020-02-26 09:42:51 +01:00
Juan Linietsky
33b5c57199 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.

Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.

For Variant, the float datatype is always 64 bits, and exposed as `float`.

We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.

Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-25 12:55:53 +01:00
Rémi Verschelde
2cf6ac6c50 Replace FALLTHROUGH macro by C++17 [[fallthrough]]
This attribute is now part of the standard we target so we no longer
need compiler-specific hacks.

Also enables -Wimplicit-fallthrough for Clang now that we can properly
support it. It's already on by default for GCC's -Wextra.

Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
2020-02-23 00:52:50 +01:00
clayjohn
b0ff427a2a properly flip sky when rendering reflection probes 2020-02-21 11:42:00 -08:00
Juan Linietsky
3c0059650d Added StringName as a variant type.
Also changed all relevant properties defined manually to StringName.
2020-02-21 14:25:29 +01:00
Fabio Alessandrelli
cbc450c0e5 Huge Debugger/EditorDebugger refactor. 2020-02-21 11:12:03 +01:00
Juan Linietsky
69c95f4b4c Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
Andrii Doroshenko (Xrayez)
fa766265a7 Fix MIMPAMPS typos in constants throughout the engine 2020-02-20 01:31:43 +02:00
Rémi Verschelde
49fec646cb Fix compilation warnings and re-enable werror=yes on Travis
Fix -Wunused-variable, -Wunused-but-set-variable and -Wswitch warnings
raised by GCC 8 and 9.

Fix -Wunused-function, -Wunused-private-field and
-Wtautological-constant-out-of-range-compare raised by Clang.

Fix MSVC 2019 warning C4804 (unsafe use of type 'bool' in comparison
operation).

GCC -Wcpp warnings/Clang -W#warnings (`#warning`) are no longer raising
errors and will thus not abort compilation with `werror=yes`.

Treat glslang headers are system headers to avoid raising warnings.

Re-enables us to build with `werror=yes` on Linux and macOS, thus
catching warnings that would be introduced by new code.

Fixes #36132.
2020-02-18 20:51:25 +01:00
Andrea Catania
79fc7d7d6a Added utility functions to the new NavigationServer:
- Vector3 get_closest_point_to_segment(const Vector3 &p_from, const Vector3 &p_to, const bool &p_use_collision = false);
- Vector3 get_closest_point(const Vector3 &p_point);
- Vector3 get_closest_point_normal(const Vector3 &p_point);
- Object *get_closest_point_owner(const Vector3 &p_point);
2020-02-18 17:12:45 +01:00
Juan Linietsky
3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Marcel Admiraal
b6c9c6261d Fix VisualServer bindings. 2020-02-17 07:07:28 +01:00
Yuri Roubinsky
a1da8560ee Fix shader crash if duplicated struct members created 2020-02-15 22:19:45 +03:00
Haoyu Qiu
d9b5cbdffa Fixes memory leaks in GdNavigationServer and RasterizerSceneHighEndRD 2020-02-15 14:25:32 +08:00
Marcin Zawiejski
2842c6a88c fix oob write when calling MultiMesh::set_instance_transform 2020-02-14 17:48:48 +01:00
Rémi Verschelde
415a901b68
Merge pull request #36194 from dragmz/dragmz/exit_crash_fix
Fix crash when closing project manager
2020-02-14 14:31:54 +01:00
Rémi Verschelde
79d42069a9
Merge pull request #36208 from akien-mga/warnings
Fix various GCC compilation warnings after Vulkan merge
2020-02-14 13:49:20 +01:00
Rémi Verschelde
d2537407ef Fix various GCC compilation warnings after Vulkan merge
Part of #36132.
2020-02-14 10:02:31 +01:00
clayjohn
b878e5bbe8 Fix error flood with sky background 2020-02-13 16:31:21 -08:00
Marcin Zawiejski
17ea60bb92 fix crash when closing project manager 2020-02-13 22:03:46 +01:00
Yuri Roubinsky
41643e268e Prevent usage 'out' modifier on opaque shader types (textures currently) 2020-02-13 21:02:47 +03:00
Hugo Locurcio
71b74195de
Remove Vulkan debugging prints 2020-02-13 18:50:07 +01:00
Yuri Roubinsky
01de6513ac Fix bugs in shader swizzling 2020-02-13 18:11:21 +03:00
Yuri Roubinsky
ef51726ff3
Merge pull request #36176 from Chaosus/shader_fix_const_crash
Fix shader crash if pass const argument to 'out/inout' parameter
2020-02-13 17:00:37 +03:00
Yuri Roubinsky
516aa46fe5 Fix shader crash if pass const argument to 'out/inout' parameter 2020-02-13 16:15:08 +03:00
Rémi Verschelde
54ac8eaba6 Remove more deprecated methods and code 2020-02-13 12:37:45 +01:00
Juan Linietsky
cf8c679a23 ObjectID converted to a structure, fixes many bugs where used incorrectly as 32 bits. 2020-02-12 14:24:54 -03:00
Yuri Roubinsky
4aa31a2851
Merge pull request #36141 from Chaosus/shader_struct_member_arrays
Added support for arrays as shader struct members
2020-02-12 20:12:05 +03:00
Yuri Roubinsky
6b99bda1e8 Added support for arrays as shader struct members 2020-02-12 17:10:20 +03:00
Rémi Verschelde
0e3d625737 doc: Sync classref with current source
Lots of internal API changes and some docstrings were lost in the conversion.
I manually salvaged many of them but for all the rendering-related ones, an
additional pass is needed.

Added missing enum bindings in BaseMaterial3D and VisualServer.
2020-02-12 12:37:13 +01:00
Haoyu Qiu
4c42fb0eb7 Fixes friend declaration tag mismatch 2020-02-12 17:41:30 +08:00
Yuri Roubinsky
6f162395ff Implementation of 'struct' for shaders 2020-02-11 20:00:42 +03:00
Rémi Verschelde
db81928e08 Vulkan: Move thirdparty code out of drivers, style fixes
- `vk_enum_string_helper.h` is a generated file taken from the SDK
  (Vulkan-ValidationLayers).
- `vk_mem_alloc.h` is a library from GPUOpen:
  https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
2020-02-11 14:08:44 +01:00
Yuri Roubinsky
21e3cc7bb8 [Vulkan] Fix shader crash if using multiple underscores in identifier names 2020-02-11 12:16:22 +01:00
Juan Linietsky
2049dec79e Added normalmap guided roughness mipmap generator, and a global roughness limiter. 2020-02-11 12:16:01 +01:00
Juan Linietsky
bed8980ca5 Re-implemented screen space ambient occlusion 2020-02-11 12:15:46 +01:00
Juan Linietsky
ee1e89f8c0 Modified rendering to use cluster instead of foward 2020-02-11 12:15:27 +01:00
Juan Linietsky
f8b5c5f063 DOF fully implemented, can be edited on the fly. 2020-02-11 12:15:26 +01:00
Juan Linietsky
c05da81268 Mostly working DOF Bokeh 2020-02-11 12:15:04 +01:00
Juan Linietsky
f14defb6f9 WIP CameraEffects implementation (bokeh not working for now) 2020-02-11 12:15:03 +01:00
Juan Linietsky
bd364d1447 Auto exposure re-implemented in Vulkan 2020-02-11 12:14:23 +01:00
Juan Linietsky
b859e69919 -Refactored post processing, re-added glow and added a mix blend mode. 2020-02-11 12:14:21 +01:00
clayjohn
e530f49be2 Fix Specular Blinn in vulkan 2020-02-11 12:10:36 +01:00
Rémi Verschelde
6310354cde Vulkan: Fix false positive in ninepatch axis stretch code
Adapted from e4907e50fe,
supersedes and closes #34704.
2020-02-11 12:09:55 +01:00
Fabian Mathews
ba6d9597cb Fixed error condition check for multimesh instance colors 2020-02-11 12:07:03 +01:00
Rémi Verschelde
4cac20aea3 Fix crash after rebase on the master branch
Apparently rasterizer is not initialized yet when this is called
the first time, so it crashes.
2020-02-11 12:06:20 +01:00
Matias Pierdomenico
0e20e349f1 Changed variable name in shader because it was too generic 2020-02-11 12:06:05 +01:00
Rémi Verschelde
fff4240bb4 Fix code formatting issues and VS compilation
Also temporarily disable multicheck build so that we get a full build
even when there are style issues on Vulkan.

Fixes #33356.
2020-02-11 12:05:19 +01:00
Juan Linietsky
b509c814fc Improved Voxel AO settings. 2020-02-11 12:05:05 +01:00
Juan Linietsky
4949d578f2 Dynamic objects in GIProbes are now affected by propagation parameter. 2020-02-11 12:05:05 +01:00
Juan Linietsky
d6e4b45994 More correctly divide alpha by 8 for mipmaps, fixes voxel overocclusion. 2020-02-11 12:05:04 +01:00
Juan Linietsky
8deb977551 Changed SDF processing to smooth out shadows. 2020-02-11 12:05:03 +01:00
Juan Linietsky
da0457fa29 Several fixes to GIProbes 2020-02-11 12:04:56 +01:00
Juan Linietsky
971ce680f2 Fixes to how anisotropy is handled, makes it work on nvidia. 2020-02-11 12:04:56 +01:00
Juan Linietsky
f4948721e4 Fixed uninitialized memory bug in voxelizer 2020-02-11 12:04:54 +01:00
Juan Linietsky
2af701fa03 Use a different strategy to get textures from GPU (via buffers), for more compatibility. 2020-02-11 12:04:54 +01:00
Juan Linietsky
2c67cc654f AO support for GIProbe (right on time for Godot Sprint!) 2020-02-11 12:03:55 +01:00
Juan Linietsky
76c6f39d99 GIProbe now generates a distance field on bake using CPU, for better compatibility 2020-02-11 12:03:54 +01:00
Juan Linietsky
561b431d85 Dynamic object support for GI Probes (a bit buggy still) 2020-02-11 12:03:52 +01:00
Juan Linietsky
6ee2f5e6b6 More GIProbe work and fixes 2020-02-11 12:03:49 +01:00
bruvzg
26318f3bd1 Fix Vector3 ambiguities and out of bounds init. 2020-02-11 12:03:39 +01:00
Juan Linietsky
fb739f9da7 Fixed display menu visualizations. 2020-02-11 12:03:24 +01:00
Juan Linietsky
965185c765 Better GIProbe quality settings. 2020-02-11 12:03:23 +01:00
Juan Linietsky
fa548b052e Missing proper comparison for depth pre-pass. 2020-02-11 12:03:21 +01:00
Juan Linietsky
acf0f6c8a7 GIProbes working. 2020-02-11 12:03:20 +01:00
Juan Linietsky
4aea9f74e6 Rewritten StreamTexture for better code reuse, added basis universal support 2020-02-11 12:02:36 +01:00
Juan Linietsky
263bebe023 Untested support for compute shaders 2020-02-11 12:02:34 +01:00
Juan Linietsky
b08f13d558 Skeletons are now working. 2020-02-11 12:02:17 +01:00
Rémi Verschelde
e3b76fd040 Merge pull request #32281 from Chaosus/vk_shader_array_varying2
[Vulkan] Implement shader array support for varyings
2020-02-11 12:02:06 +01:00
Yuri Roubinsky
bfa834a78a [Vulkan] Implement shader array support for varyings
Remake of #32175
2020-02-11 12:02:02 +01:00
Rémi Verschelde
d08bf966eb Merge pull request #32280 from Chaosus/vk_shader_switch2
[Vulkan] Implements switch flow control operator in shaders
2020-02-11 12:01:59 +01:00
Yuri Roubinsky
d51b7aafb5 [Vulkan] Implements switch flow control operator in shaders 2020-02-11 12:01:49 +01:00
Juan Linietsky
bc3dbe8240 Properly working instancing, and compatibility fixing for old meshes 2020-02-11 12:01:33 +01:00
Juan Linietsky
123ee5995c Visual GPU profiler and related profiling support in Vulkan. 2020-02-11 12:01:26 +01:00
Juan Linietsky
dc32083681 Proper texture reloading (was broken). 2020-02-11 12:01:25 +01:00
Juan Linietsky
dd3682e5fe Modernized default 3D material, fixes material bugs. 2020-02-11 12:01:24 +01:00
Juan Linietsky
6deffa62fb Several fixes to 3D rendering, and multimesh implementation. 2020-02-11 12:01:22 +01:00
Juan Linietsky
9d7b7f931b Reflection probes working 2020-02-11 12:01:21 +01:00
Juan Linietsky
69e83e4815 Directional light cleanup. 2020-02-11 12:01:21 +01:00
Juan Linietsky
88a7debbbc Directional lights and shadow mapping are functional. 2020-02-11 12:01:20 +01:00
Juan Linietsky
920db604d2 Rewrote large part of rendering, omni and spot shadows now work. 2020-02-11 12:01:18 +01:00
Juan Linietsky
1d871f6226 Tonemapping ported (not all parameters supported yet, only enough to get correct color) 2020-02-11 12:01:09 +01:00
Juan Linietsky
2d6a916835 Environment sky more or less working. 2020-02-11 12:01:05 +01:00
Rémi Verschelde
f7aa7927e7 Merge pull request #31527 from Chaosus/vk_shader_array_support2
[Vulkan] Implemented local shader arrays
2020-02-11 12:00:53 +01:00
Yuri Roubinski
ef50752292 [Vulkan] Implemented local shader arrays 2020-02-11 12:00:46 +01:00
Rémi Verschelde
86d0d88b42 Merge pull request #31526 from Chaosus/shader_bug_vk2
[Vulkan] Fix ternary operator shader compiler expression
2020-02-11 12:00:16 +01:00
Yuri Roubinski
47c0ef3308 [Vulkan] Fix ternary operator shader compiler expression 2020-02-11 12:00:10 +01:00
Yuri Roubinski
95e8375efb [Vulkan] Implemented do/while loops for shaders 2020-02-11 11:59:51 +01:00
Juan Linietsky
8cee7703a6 Yay very basic 3D (only white) finally shows. 2020-02-11 11:59:27 +01:00
Juan Linietsky
449df8f688 Base 3D engine done, still untested, though. 2020-02-11 11:59:25 +01:00
Juan Linietsky
dc3b47f3ab Vulkan/RD rasterizer now does clean exit. 2020-02-11 11:58:16 +01:00
Juan Linietsky
b52a2f3dfa Fix comment 2020-02-11 11:58:11 +01:00
Rémi Verschelde
6289e7d147 Merge pull request #29993 from bruvzg/vulkan
Initial Vulkan support for macOS (MoltenVK) and Windows
2020-02-11 11:57:40 +01:00
bruvzg
b456bfad5c Add runtime GLES2 / Vulkan context selection. 2020-02-11 11:57:34 +01:00
bruvzg
eb48be51db Add static Vulkan loader.
Initial Vulkan support for Windows.
Initial Vulkan support for macOS.
2020-02-11 11:57:11 +01:00
Juan Linietsky
6ecedd1e6c Add a system to properly update materials if the uniform set is gone (likely deleted texture) 2020-02-11 11:53:29 +01:00
Juan Linietsky
4fe3ee1730 Moved the shader source compilation code outside RenderingDevice and Vulkan 2020-02-11 11:53:29 +01:00
Juan Linietsky
c613ead5fa Added a spinlock template as well as a thread work pool class.
Also, optimized shader compilation to happen on threads.
2020-02-11 11:53:29 +01:00
Juan Linietsky
60c7498cee Replaced GLSLang reflection by SPIRV-Reflect, eventually allowing to move GLSLang out. 2020-02-11 11:53:29 +01:00
Juan Linietsky
0586e18449 Custom material support seems complete. 2020-02-11 11:53:29 +01:00
Juan Linietsky
8bbbb97336 Completed material/2D shader support (missing SCREEN_TEXTURE) 2020-02-11 11:53:29 +01:00
Juan Linietsky
50e9befb88 Changes to material required to add custom shaders in RD renderer 2020-02-11 11:53:28 +01:00
Juan Linietsky
ef083a583b Modified light rendering to make it more compatible.
Modified polygon management to make it more compatible with MoltenVK
2020-02-11 11:53:28 +01:00
Juan Linietsky
a3f8ffac63 Use a special sampler for 2D shadows, so they are softer 2020-02-11 11:53:28 +01:00
Juan Linietsky
f04359e70f 2D lighting seems more or less complete. 2020-02-11 11:53:28 +01:00
Juan Linietsky
a7b2ac7bb1 Normalmapping and Specularmapping working in 2D engine
Added support for Sprite, AnimatedSprite and Polygon2D (should add for tileset eventually).
2020-02-11 11:53:28 +01:00
Juan Linietsky
92b27bccf1 Changed allocation strategy of CanvasItem draw commands.
They should now allocate memory in blocks and reuse the same
memory every time the item is cleared and redrawn.

This should improve performance considerably.
2020-02-11 11:53:28 +01:00
Juan Linietsky
24b16f3bf0 Fix crash on import. 2020-02-11 11:53:28 +01:00