Commit Graph

2980 Commits

Author SHA1 Message Date
Juan Linietsky
f999f52f0a Add a Framebuffer cache
Adds a FramebufferCache singletion that operates the same way as UniformSetCache.

Allows creating framebuffers on the fly (and keep them cached if re-requested) such as:

```C++
RID fb = FramebufferCache::get_singleton()->get_cache(texture1,texture2);
```
2022-08-05 13:37:29 +02:00
Fabio Alessandrelli
59eea34851 [Net] IP uses print_verbose when getaddrinfo fails.
Avoid spamming errors when network is disconnected.
Returned address will be invalid, so it can be checked by the user via
`ret.is_valid_ip_address`.
2022-08-05 10:49:56 +02:00
Hugo Locurcio
db22b7ded0
Rename shader parameter uniform setter/getter methods for consistency
`shader_uniform` is now consistenly used across both per-shader
and per-instance shader uniform methods. This makes methods easier
to find in the class reference when looking for them.
2022-08-04 23:17:06 +02:00
Rémi Verschelde
8a9700c8a7 Force disable S3TC support on Android/iOS since we don't handle it
Fixes #63909 for now.
This could be improved in the future if we want to properly support S3TC on mobile.
2022-08-04 18:27:56 +02:00
Hugo Locurcio
d2271eb300
Improve error message when the requested V-Sync mode cannot be used 2022-08-04 00:15:09 +02:00
Rémi Verschelde
9daffa12be
Merge pull request #49058 from madmiraal/add-override-fileaccess
Add override keywords to FileAccess and DirAccess derived classes
2022-08-02 20:03:24 +02:00
Marcel Admiraal
c06025fa13 Add override keywords to DirAccess derived classes 2022-08-02 16:39:44 +01:00
Marcel Admiraal
cafb19e608 Add override keywords to FileAccess derived classes 2022-08-02 16:35:15 +01:00
Patrick Exner
fe5901310e Add spatial built-ins (camera-pos, object-pos, camera-eye etc.) 2022-08-02 17:30:41 +02:00
Rémi Verschelde
8cce479c01
Merge pull request #51672 from Calinou/shader-add-hint-transparent-texture
Add `hint_transparent` to use a transparent black placeholder texture
2022-08-02 07:15:59 +02:00
Hugo Locurcio
813f6a5d57
Add hint_transparent to use a transparent black placeholder texture
This can be used in shaders to avoid the need to supply a transparent
placeholder texture manually.
2022-08-01 23:38:06 +02:00
clayjohn
4b80cb4aa3 Fix various bugs in GLES3 renderer that stopped it from running on web 2022-08-01 16:45:32 -04:00
Yuri Rubinsky
9ec6de1767
Merge pull request #63766 from Chaosus/fix_shader_instance_uniform 2022-08-01 15:04:54 +03:00
Yuri Rubinsky
81c44718ca Fix passing values to the instance uniforms in the shader 2022-08-01 13:45:29 +03:00
Rémi Verschelde
d29e95687e
Merge pull request #63761 from BastiaanOlij/gles3_scene_singleton_init 2022-08-01 11:35:19 +02:00
Bastiaan Olij
367507e7da Initialise singleton in RendererSceneGLES3 2022-08-01 18:42:42 +10:00
Rémi Verschelde
677f565ce8
Merge pull request #63587 from clayjohn/specular-occlusion
Treat specular less than 0.02 as occlusion
2022-08-01 07:54:57 +02:00
clayjohn
0c65ed38a6 Treat specular less than 0.02 as occlusion
This is a very common hack used in almost all PBR renderers to allow removing specular contribution in dielectric materials
2022-07-31 15:45:21 -07:00
Rémi Verschelde
15a02c49be
Merge pull request #61647 from KoBeWi/SaverResource 2022-07-29 22:30:51 +02:00
kobewi
c3606cb5f3 Swap arguments of ResourceSaver.save() 2022-07-29 19:53:09 +02:00
LinuxUserGD
6e6569aa78 fix 'Comparison result is always the same' warnings 2022-07-29 19:45:22 +02:00
Rémi Verschelde
2bf8c4a6d0
Merge pull request #63527 from BastiaanOlij/rework_environment
Restructure environment in render implementation
2022-07-29 08:05:40 +02:00
Bastiaan Olij
f579125eeb Restructure environment in render implementation 2022-07-29 12:24:32 +10:00
Rémi Verschelde
8e0f328a80
Merge pull request #59840 from Calinou/renderingserver-global-uniform-rename 2022-07-28 20:34:17 +02:00
Hugo Locurcio
4b42379c8f
Rename RenderingServer global shader uniform methods to be more explicit
The `global_shader_uniform` name is longer, but it makes it much
easier to find the methods when searching in the class reference.
2022-07-28 18:46:59 +02:00
Hugo Locurcio
e24029edc3
Allow changing mipmap LOD bias when FSR 1.0 scaling is not used
Mipmap LOD bias can be useful to improve the appearance of distant
textures without increasing anisotropic filtering (or in situations
where anisotropic filtering is not effective).

`fsr_mipmap_bias` was renamed to `texture_mipmap_bias` accordingly.
The property hint now allows for greater precision as well.
2022-07-28 17:51:13 +02:00
Rémi Verschelde
82811367cb
Merge pull request #63571 from RandomShaper/conservative_validate_vrs 2022-07-28 15:34:47 +02:00
Pedro J. Estébanez
5f71b55380 Improve handling of the format of the VRS image
- Validate format conservatively. (This is to have VRS images created regardless whether VRS attachments are supported, which avoids errors in places where the code assumes such images were created on low-spec GPUs.)
- Create a non-layered default VRS image, which is what Vulkan (and D3D12, by the way) expect.
2022-07-28 12:24:03 +02:00
Rémi Verschelde
199ea349f5
Merge pull request #57698 from bluenote10/feature/rename_translated_to_translated_local 2022-07-28 10:03:07 +02:00
Pedro J. Estébanez
df0a7ce17a Remove unintended string copies 2022-07-27 18:16:57 +02:00
Rémi Verschelde
a446d761fb
Merge pull request #63296 from RandomShaper/fix_vk_singleview 2022-07-27 13:23:45 +02:00
Pedro J. Estébanez
6d0c84717f Fill view and correlation masks correctly for single view in Vulkan RD 2022-07-27 13:15:50 +02:00
Rémi Verschelde
57ac638724
Merge pull request #63314 from RandomShaper/validate_vrs_format 2022-07-27 13:01:46 +02:00
Rémi Verschelde
d7a1acd229
Merge pull request #62364 from clayjohn/GLES3-sky-optimization 2022-07-27 12:39:58 +02:00
Rémi Verschelde
d5ec1a9650
Merge pull request #63477 from Chaosus/shader_fix_fog 2022-07-27 09:35:30 +02:00
Rémi Verschelde
e8309d49e0
Merge pull request #63345 from BastiaanOlij/split_geometry_instance
Cleanup RendererSceneRender::GeometryInstance
2022-07-27 08:28:24 +02:00
Yuri Rubinsky
bbf76faf86 Fix FOG built-in in spatial/fragment shader 2022-07-27 08:31:06 +03:00
Bastiaan Olij
0bd042c601 Change RendererSceneRender::GeometryInstance so more code is shared among renderers 2022-07-27 12:32:07 +10:00
Rémi Verschelde
f4e603f432
Merge pull request #63323 from RandomShaper/const_ref_capabilities
Avoid copies of structures when returning Vulkan capabilities
2022-07-26 20:55:46 +02:00
Yuri Rubinsky
886c2d9681 Implement shader uniform groups/subgroups 2022-07-26 11:26:09 +03:00
Rémi Verschelde
90019676b0 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 11:17:40 +02:00
reduz
455c06ecd4 Implement Vector4, Vector4i, Projection
Implement built-in classes Vector4, Vector4i and Projection.

* Two versions of Vector4 (float and integer).
* A Projection class, which is a 4x4 matrix specialized in projection types.

These types have been requested for a long time, but given they were very corner case they were not added before.
Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity.

**Q**: Why Projection and not Matrix4?
**A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-23 14:00:01 +02:00
Rémi Verschelde
fe929d4787
Merge pull request #62513 from reduz/shader_preprocessor_remake 2022-07-23 00:02:33 +02:00
Rémi Verschelde
4f7bfacfcd
Merge pull request #62478 from BastiaanOlij/split_effects_20220628 2022-07-22 23:44:52 +02:00
reduz
f649678402 Clean up Shader Preprocessor
* Moved preprocessor to Shader and ShaderInclude
* Clean up RenderingServer side
* Preprocessor is separate from parser now, but it emits tokens with include location hints.
* Improved ShaderEditor validation code
* Added include file code completion
* Added notification for all files affected by a broken include.
2022-07-22 22:53:03 +02:00
Pedro J. Estébanez
e49e9fec22 Avoid copies of structures when returning Vulkan capabilities 2022-07-22 22:07:51 +02:00
Pedro J. Estébanez
06333fb732 Validate texture format for VRS attachment 2022-07-22 15:05:31 +02:00
bruvzg
8823eae328
Rename OSX to macOS and iPhoneOS to iOS. 2022-07-21 09:37:52 +03:00
Rémi Verschelde
3fe89e7fa9
Merge pull request #63237 from RandomShaper/amend_error_msg 2022-07-20 21:39:43 +02:00
Riteo
a21f8b7c13 Improve linuxbsd headless building, cleanup build scripts
Now the `linuxbsd` platform can be built headlessly (e.g. without X11
development libraries).

I also cleaned up some weird (old?) usages of the `env` variable which
seem to make no difference and are used nowhere else.
2022-07-20 19:48:35 +02:00
Pedro J. Estébanez
73ba313368 Improve messages about VRS 2022-07-20 19:37:05 +02:00
Bastiaan Olij
b9c94f6780 Add missing fields to VkRenderPassCreateInfo2KHR struct 2022-07-20 12:52:37 +10:00
Bastiaan Olij
eefcb5ed67 Move screen space effects into a separate class 2022-07-19 13:27:39 +10:00
Rémi Verschelde
d29e17d9d2
Merge pull request #63057 from sakrel/vulkan-fix-2d-shadows 2022-07-18 21:53:12 +02:00
Rémi Verschelde
9276c65522
Merge pull request #62265 from d-robbins/specular_shininess_used 2022-07-18 21:35:46 +02:00
Rémi Verschelde
5bea531228
Merge pull request #62848 from RandomShaper/shader_writability_improvement 2022-07-18 15:11:42 +02:00
Pedro J. Estébanez
309f7965c7 Enhance determination of uniform writability in Vulkan RD
- Check block decoration in addition to type decoration to be sure to find `readonly` decorators
- Verify uniforms have same writability across all shader stages in Vulkan RD
2022-07-18 14:46:28 +02:00
Pedro J. Estébanez
77a525168d Improve versioning of shader binary data files
- Include Godot version and commit hash in shader cache key
- Reject files when format doesn't match, even if it's lower, since we don't have backwards compatibility here
2022-07-18 14:45:36 +02:00
David R
c2b0a873c2 added usage_defines for SPECULAR_SHININESS
added usage defines for opengl3 renderer
2022-07-18 00:45:42 +02:00
Aaron Franke
97df94ae90
Update comments in vulkan_context.cpp
Co-authored-by: Quinn Leavitt <59779489+QuinnLeavitt@users.noreply.github.com>
2022-07-17 12:45:17 -05:00
Bastiaan Olij
d139131aab Adding Variable Rate Shading support to Godot
Improve GI renderer and add VRS support
Implement render device has_feature and move subgroup settings to limit_get
2022-07-17 15:42:24 +10:00
Fabian Keller
2bf9e6090c rename translate(d) to translate(d)_local in Transform 2D/3D 2022-07-16 11:47:54 +02:00
sakrel
16a8967757 Fix DirectionalLight2D and PointLight2D shadows not rendering correctly 2022-07-15 23:55:15 +02:00
Hugo Locurcio
21ea1c3835
Rename soft shadow quality project settings for easier searching
`rendering/quality/shadows` is now `rendering/quality/positional_shadow`
to explicitly denote that the settings only affect positional light shadows,
not directional light shadows.

Shadow atlas settings now contain the word "atlas" for easier searching.

Soft shadow quality settings were renamed to contain the word "filter".
This makes the settings appear when searching for "filter" in the
project settings dialog, like in Godot 3.x.
2022-07-13 19:56:02 +02:00
bruvzg
0c5431644d
Allows parsing of invalid UTF-16 surrogates (can be encountered in Windows filenames) and some non-standard UTF-8 variants, makes Unicode parse errors more verbose. 2022-07-07 11:07:18 +03:00
Pedro J. Estébanez
498bbd0fb4 Set default resource names under pure debug in Vulkan RD 2022-07-06 19:19:16 +02:00
Yuri Rubinsky
3dc1a1dbfb Prevent possible crash when mesh is freed 2022-07-06 19:52:54 +03:00
Rémi Verschelde
55fca1cb94
Merge pull request #62344 from BastiaanOlij/extract_dependencies 2022-07-06 13:24:46 +02:00
Hugo Locurcio
c9037a8d2c
Remove unused anisotropy setter/getter methods in VoxelGI
These methods weren't exposed to the scripting API.

Anisotropy was used in earlier iterations of VoxelGI, but it was
removed as it was too expensive.
2022-07-06 02:40:49 +02:00
Shlomi
22da234eb6 Add Desktop to file dialog drive on Unix 2022-07-05 13:10:15 +02:00
Fredia Huya-Kouadio
f9c19298ce Add full support for Android scoped storage.
This was done by refactoring directory and file access handling for the Android platform so that any general filesystem access type go through the Android layer.
This allows us to validate whether the access is unrestricted, or whether it falls under scoped storage and thus act appropriately.
2022-07-05 03:00:37 -07:00
Rémi Verschelde
08044aa2e3 Vulkan: Make loader_get_json "error" a verbose message on Windows
In far most cases it seems like it's going to message about bogus manifests
in the Windows registry which point to JSON files which have since been
uninstalled, but without clearing the registry.

This happens with bogus Vulkan overlays from Twitch, Epic Online Services,
NVIDIA Nsight Systems, OBS Studio, Rockstar Games... fix your mess folks.

Fixes #56089.
2022-07-02 19:25:01 +02:00
Rémi Verschelde
6bbfd160b0 SCons: Properly track codegen script dependency for generated GLSL headers 2022-07-02 16:01:48 +02:00
Pedro J. Estébanez
95ac9081d6 Use a more robust method of determining writability of bindings 2022-06-30 20:07:30 +02:00
clayjohn
93c82ab4b9 Evaluate specular reflections using specular dominant direction instead of assuming mirror reflections 2022-06-29 23:36:18 -07:00
Pedro J. Estébanez
a82352c7e3 Avoid manual memory management of certain arrays in Vulkan RD 2022-06-28 10:01:46 +02:00
Pedro J. Estébanez
3d58b79792 Fix confusion between Vulkan and RD storage buffer usage values 2022-06-28 10:01:46 +02:00
Pedro J. Estébanez
525de52b08 Stop debug time full barriers preventing layout transitions in Vulkan RD 2022-06-28 10:01:45 +02:00
Pedro J. Estébanez
e1645567a6 Optimize texture update in Vulkan RD 2022-06-28 10:01:45 +02:00
Pedro J. Estébanez
509c0eb86b Apply some small fixes/enhancements to the Vulkan RD
- Initialize queue indices to values meaning 'unset'
- Remove unused parameters & members
- Make texture update access flags consistent with texture copy
- Fix style and pass type of some parameters
- Synchronize setup-draw in flush with a semaphore
- Add no current list validation to draw_list_begin_splits()
- Update texture usage flags on destination of copy
- Fix misuse of Vulkan flag
2022-06-28 10:01:45 +02:00
Pedro J. Estébanez
fc6ac4a155 Consider uniform writability part of the interface of the set 2022-06-27 21:56:18 +02:00
Bastiaan Olij
ecfcfd97fa Split dependency logic
Split FOG
Split visibility notifier
Final cleanup of storage classes
2022-06-28 00:10:29 +10:00
clayjohn
88830509d1 Precompute on the CPU as much as possible for the Cubemap filter shader 2022-06-22 16:46:27 -07:00
Bastiaan Olij
997810e417 Split GI effects and fix stereoscopic rendering of GI effects 2022-06-22 12:50:17 +10:00
reduz
141c375581 Clean up Hash Functions
Clean up and do fixes to hash functions and newly introduced murmur3 hashes in #61934
* Clean up usage of murmur3
* Fixed usages of binary murmur3 on floats (this is invalid)
* Changed DJB2 to use xor (which seems to be better)
2022-06-20 12:54:19 +02:00
Bastiaan Olij
b4821fe2e0 Introduce eye_offset for correcting stereoscopic reflections
Use view instead of vertex for reflections.
2022-06-17 19:39:34 +10:00
clayjohn
5f52936350 Implement MultiMesh in 3D and flesh out MultiMesh functions 2022-06-14 21:23:20 -07:00
jfons
ba832d83b2 Initial TAA implementation
Initial TAA support based on the implementation in Spartan Engine.

Motion vectors are correctly generated for camera and mesh movement, but there is no support for other things like particles or skeleton deformations.
2022-06-07 13:14:44 +02:00
Bastiaan Olij
69b66ec425 Ensure has_os_features is safely called as it can't be called from within the construct of RenderingServerDefault on which it relies 2022-06-01 20:47:32 +10:00
clayjohn
ae64b4967c Implement NinePatchRects in GLES3 renderer 2022-05-25 16:51:40 -07:00
Rémi Verschelde
20a1b85589
Merge pull request #61425 from clayjohn/GLES3-2D 2022-05-26 01:16:52 +02:00
clayjohn
fb860265e0 Implement 2D Meshes and MultiMeshes in GLES3 backend 2022-05-25 15:46:24 -07:00
Rémi Verschelde
12ddaa36a6
Merge pull request #60641 from clayjohn/Sky-ign
Use IGN instead of white noise for sky dithering
2022-05-24 23:34:41 +02:00
clayjohn
3e20c1347d Add clipping, backbuffer, and CanvasGroups to 2D GLES3 renderer
As well as significant consequent cleanup in the RenderTarget, Texture, and Canvas renderer code
2022-05-24 11:00:34 -07:00
clayjohn
4f82b1bd20 Use IGN instead of white noise for sky dithering 2022-05-24 10:57:07 -07:00
Rémi Verschelde
1314e6cbcc
Merge pull request #60803 from Chaosus/shader_hint_rename
Rename `hint_albedo`, `hint_white/black` in shaders
2022-05-24 08:15:33 +02:00
reduz
45af29da80 Add a new HashSet template
* Intended to replace RBSet in most cases.
* Optimized for iteration speed
2022-05-20 22:40:38 +02:00
clayjohn
39f1be760f Fix sky updating when DirectionalLight mode changed and shader compatibility for certain drivers 2022-05-19 17:44:38 -07:00
Aaron Record
900c676b02 Use range iterators for RBSet in most cases 2022-05-19 12:09:16 +02:00
Yuri Rubinsky
5322b171de Fix tonemapper shader to correctly apply alpha channel 2022-05-18 06:43:07 +03:00
clayjohn
9b61c855ef Add basic lighting to GLES3 renderer.
This includes all three light types and IBL, but does not include shadows or any form of GI
2022-05-16 15:07:09 -07:00
reduz
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
Somnath Sarkar
52aeaf5d16 Fix computation of screen_uv 2022-05-16 00:00:01 -04:00
Rémi Verschelde
349aa9c884
Merge pull request #60894 from derammo/derammo_opengl3_windows 2022-05-13 15:07:13 +02:00
Rémi Verschelde
ff30a09993
Merge pull request #60643 from clayjohn/GLES3-3D 2022-05-12 21:08:02 +02:00
clayjohn
652adcd5bf Basic 3D rendering 2022-05-12 10:37:27 -07:00
reduz
8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
clayjohn
2bf8831dd6 SceneShader compiling 2022-05-11 21:00:21 -07:00
clayjohn
3bb8e6a9fe SkyShaders working 2022-05-11 21:00:21 -07:00
derammo
96c21bc749 opengl3 driver now works on windows including multi window
fixed and simplified gl_manager_windows
swap buffers now called for all windows
fixed missing pixel format setting in additional windows
    this makes them work in OpenGL contexts
changed verbose error printing to write once
    this error message happens very frequently while opengl3 is not finished
removed dead code no longer needed after changes
fixed comments that were misinformation
window messages during window creation now handled
    these were previously discarded
    messages now tunnel the required context
changed failure to create opengl3 window on windows to be more fatal
marked a problem with pen code
conditional compilation of vulkan and opengl3 on windows fixed
windows debug builds now show messages on debug console also
rendering driver selection box now shows only compiled drivers
marked some problematic code
thanks to akien-mga for patiently rewriting my style mistakes
2022-05-11 16:12:40 -04:00
Fabio Alessandrelli
d2bb5b88cc [GL] Fix HTML5 builds.
Safer guards for debug functions.
GL_FRAMEBUFFER_INCOMPLETE_* functions seem to be OpenGL 4.
2022-05-11 00:26:26 +02:00
bruvzg
ffe61e0895
[macOS / iOS] Fix text-to-speech build with older macOS / iOS SDK.
Add __has_include check for AVFAudio include.
Add some explicit casts to avoid conflicts.
Change all `include`s to `import`s for consistency.
2022-05-10 21:11:34 +03:00
Rémi Verschelde
9db20ccb38
Merge pull request #60596 from clayjohn/GLES3-LightStorage
Add LightStorage functions to GLES3 renderer
2022-05-10 08:18:51 +02:00
Yuri Roubinsky
a8bbe570ca Rename hint_albedo, hint_white/black in shaders 2022-05-09 22:50:18 +03:00
Rémi Verschelde
84f64ddde9
Merge pull request #60723 from reduz/refactor-module-initialization 2022-05-04 19:08:43 +02:00
reduz
de0ca3b999 Refactor module initialization
* Changed to use the same stages as extensions.
* Makes the initialization more coherent, helping solve problems due to lack of stages.
* Makes it easier to port between module and extension.
* removed the DRIVER initialization level (no longer needed).
2022-05-04 17:34:51 +02:00
mdavisprog
f3c1232c59 Add OS::is_process_running function.
Adds the is_process_running function to the native OS class and exposes it to script.

This is implemented on Windows and Unix platforms. A stub is provided for other platforms that do not support this function.

Documentation is updated to reflect new API function.
2022-05-03 17:27:17 -07:00
Aaron Franke
fa7a7795f0
Rename Basis get_axis to get_column, remove redundant methods 2022-05-03 09:37:47 -05:00
Rémi Verschelde
6530d46d67
Merge pull request #51102 from Calinou/renderingserver-add-api-version-getter
Add `get_video_adapter_api_version()` to RenderingServer
2022-05-03 14:44:55 +02:00
Rémi Verschelde
931838b330
Merge pull request #60627 from aaronfranke/rename-elements
Rename Transform2D and Basis `elements` to `columns` and `rows` respectively
2022-05-03 14:40:01 +02:00
Rémi Verschelde
297241f368
Merge pull request #60714 from Calinou/typedef-remove-ref
Remove `RES` and `REF` typedefs in favor of spelled out `Ref<>`
2022-05-03 14:28:18 +02:00
Rémi Verschelde
c9ce4069a3
Merge pull request #60601 from touilleMan/gdextension_get_library_path
Add GDNativeInterface::get_library_path to GDExtension
2022-05-03 08:13:34 +02:00
Hugo Locurcio
180e5d3028
Remove RES and REF typedefs in favor of spelled out Ref<>
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
2022-05-03 01:43:50 +02:00
Hugo Locurcio
31194f5b1c
Add get_video_adapter_api_version() to RenderingServer
This method can be used to get the graphics API version currently in
use (such as Vulkan). It can be used by projects for troubleshooting
or statistical purposes.
2022-05-03 01:18:35 +02:00
Rémi Verschelde
c273ddc3ee Style: Partially apply clang-tidy's cppcoreguidelines-pro-type-member-init
Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
2022-05-02 16:28:25 +02:00
Yuri Roubinsky
5eb3a0ef4a Add hint_color support for vec3 in shaders 2022-05-01 09:47:35 +03:00
Aaron Franke
1bf94dff3a
Rename Basis "elements" to "rows" 2022-04-29 08:02:56 -05:00
Aaron Franke
b831fb0a54
Rename Transform2D "elements" to "columns" 2022-04-29 08:02:39 -05:00
Emmanuel Leblond
80f61352fb
Add GDNativeInterface::get_library_path to GDExtension 2022-04-29 00:51:04 +02:00
clayjohn
fefa4a573a Add LightStorage functions to GLES3 renderer 2022-04-28 13:51:47 -07:00
clayjohn
1182c95533 Add MeshStorage to GLES3 2022-04-28 11:22:20 -07:00
Rémi Verschelde
d9b4ab3797 Fix typo after #60503 2022-04-28 20:00:40 +02:00
Rémi Verschelde
f394388aa2
Merge pull request #60503 from clayjohn/OPENGL-3D 2022-04-28 19:56:16 +02:00
Markus Sauermann
a793960a10 Fix cppcheck const parameters
Convert method signature parameters to const where it is possible

# Conflicts:
#	drivers/gles3/rasterizer_canvas_gles3.cpp
#	drivers/gles3/rasterizer_canvas_gles3.h
#	editor/plugins/animation_state_machine_editor.cpp
#	editor/plugins/animation_state_machine_editor.h
2022-04-28 11:35:39 +02:00
Rémi Verschelde
8dfa12cae7
Merge pull request #59979 from bruvzg/cpp_check2 2022-04-27 10:08:26 +02:00
Hugo Locurcio
eb497bbaa7
Fix "ortogonal" -> "orthogonal" typo in rasterizer code 2022-04-26 21:49:44 +02:00
clayjohn
2f2064fe3d Overhaul GLES3: Add basis for 3D renderer, overhaul materials and textures 2022-04-26 11:48:39 -07:00
Rémi Verschelde
63a052d96b
Merge pull request #60386 from bruvzg/label3d 2022-04-25 15:51:31 +02:00
Shnazzy
4ef7372d9e Fixed ambiguous reference to "Shader" and "Material" classes in drivers/gles3/storage/material_storage.cpp 2022-04-22 19:50:19 -04:00
bruvzg
be611c1c05
Implement Label3D node.
Add "generate_mipmap" font import option.
Add some missing features to the Sprite3D.
Move BiDi override code from Control to TextServer.
Add functions to access TextServer font cache textures.
Add MSDF related flags and shader to the standard material.
Change standard material cache to use HashMap instead of Vector.
2022-04-22 12:08:46 +03:00
bruvzg
de4c97758a
Fix more issues found by cppcheck. 2022-04-20 10:34:00 +03:00
Yuri Rubinsky
f4b0c7a1ea
Merge pull request #60175 from Geometror/visual-shader-vector4 2022-04-20 08:33:42 +03:00
clayjohn
3a4b9b47fd Initialize OpenGL before rasterizers in GLES3 2022-04-19 11:27:14 -07:00
Bastiaan Olij
0b4fd92a17 Moved particles into ParticlesStorage 2022-04-17 13:13:22 +10:00
Bastiaan Olij
b6faf6c6c0 Move light, reflection probe and lightmap into LightStorage 2022-04-17 13:13:18 +10:00
Bastiaan Olij
6b28d94e77 Merge canvas and decal into TextureStorage and add render target 2022-04-17 12:59:50 +10:00
Hendrik Brucker
cf58d23a72 Add Vector4 to VisualShader 2022-04-12 19:09:29 +02:00
bruvzg
d2ebac3a30
Remove or make private FileAccess close() methods. 2022-04-12 14:50:14 +03:00
bruvzg
9381acb6a4
Make FileAccess and DirAccess classes reference counted. 2022-04-11 13:28:51 +03:00
bruvzg
f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
Rémi Verschelde
b78aa4fe19 Style: Apply clang-tidy to current code, add readability-redundant-member-init 2022-04-04 21:49:51 +02:00
Rémi Verschelde
f8ab79e68a Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
Bastiaan Olij
b8be7903f3 Move storage for Mesh, MeshInstance, MultiMesh and Skeleton into MeshStorage 2022-04-02 16:29:04 +11:00
jfons
e69d762dd0 Add color pass flags to Forward Clustered renderer
This commit removes a lot of enum values related to the color render pass in favor of a new flag-bases approach. This means instead of hard-coding all the possible option combinations into enums, we can write our logic by checking a bit-mask.

The changes in rendering_device_vulkan.cpp add support for unused attachments. That means RenderingDeviceVulkan::framebuffer_create() can take null RIDs in the attachments vector, which will result in VK_ATTACHMENT_UNUSED entries in the render pass.

This is used in this same PR to establish fixed locations for the color pass attachments (only color and separate specular so far, but TAA will add motion vectors as well). This way the attachment locations in the shader can stay the same regardless of which attachments are actually used.

Right now all the combinations of flags are generated, but we will need to add a way to limit the amount of combinations in the future.
2022-04-01 12:12:49 +02:00
Rémi Verschelde
155a94fabe
Merge pull request #59385 from BastiaanOlij/extract_shader_storage 2022-03-31 19:19:03 +02:00
Rémi Verschelde
a647fb3e62 Fix typos with codespell
Using codespell 2.2-dev from current git.

Fix a couple incorrect uses of gendered pronouns.
2022-03-31 14:07:29 +02:00
Bastiaan Olij
36defd1179 Extract global variable, shader and material storage 2022-03-31 21:49:42 +11:00
Pedro J. Estébanez
171e31de68 vk_mem_alloc: Update to upstream + Replace use of deprecated items 2022-03-29 11:28:09 +02:00
Bastiaan Olij
0fe06e9467 Extract Decal and Decal atlas from Storage class 2022-03-21 12:22:43 +11:00
Yuri Roubinsky
0d9aecd967 Rename several transform built-ins in shaders 2022-03-18 12:10:55 +03:00
Hugo Locurcio
c45d2c242b Replace DirectionalLight3D's use_in_sky_only with sky_mode enum
3 options are available:

- Light and Sky (default)
- Light Only (new)
- Sky Only (equivalent to `use_in_sky_only = true`)

Co-authored by: clayjohn <claynjohn@gmail.com>
2022-03-17 14:00:02 -07:00
Rémi Verschelde
e142c10fc5
Merge pull request #58993 from notSanil/device-limit-exceeded-fix 2022-03-17 19:55:40 +01:00
notSanil
36fa7059ed Fix device limit exceeding for uniform buffer 2022-03-16 16:52:35 +05:30
Bastiaan Olij
57e5a33623 Split dummy renderer classes into separate files
Split canvas_texture_storage and texture_storage from render_storage class
2022-03-16 17:43:10 +11:00
kobewi
39d429e497 Change some math macros to constexpr
Changes `MAX`, `MIN`, `ABS`, `CLAMP` and `SIGN`.
2022-03-09 16:24:32 +01:00
Rémi Verschelde
9b05f29894 Remove unused GDNative code
This has been superseded by GDExtension so this code is no longer useful
nor usable.

There's still some GDNative-related stuff in platform export code which
needs to be adapted for GDExtension (e.g. to include GDExtension libraries
in exports).
2022-03-09 13:59:03 +01:00
Rémi Verschelde
1561737055
Merge pull request #49447 from Calinou/remove-shadow-color-property
Remove unused `shadow_color` property from Light3D
2022-03-08 07:48:05 +01:00
reduz
b0ca03b0a2 Add a UniformSet cache
* Changed syntax usage for RD::Uniform to create faster with a single RID
* Converted render pass setup to use this in clustered renderer to test.

This is the first step into creating a proper uniform set cache system to simplify large parts of the codebase.
2022-03-06 13:03:33 +01:00
Hugo Locurcio
aea104deb7
Remove unused shadow_color property from Light3D
This shadow color property was no longer effective since the shaders
were optimized to improve occupancy.
2022-03-04 23:12:18 +01:00
Rémi Verschelde
44e82f7073 GLES3: Fix -Wmaybe-uninitialized warning for MipMaps::Size 2022-03-04 17:09:53 +01:00
Rémi Verschelde
3078b92dff
Merge pull request #58512 from Calinou/light3d-add-distance-fade 2022-03-04 12:26:29 +01:00
Bastiaan Olij
fe5bb06df9 Fixing retrospective code for specialisation constants 2022-03-01 00:10:33 +11:00
Hugo Locurcio
b1a295b739
Implement distance fade properties in OmniLight3D and SpotLight3D
This can be used to fade lights and their shadows in the distance,
similar to Decal nodes. This can bring significant performance
improvements, especially for lights with shadows enabled and when
using higher-than-default shadow quality settings.

While lights can be smoothly faded out over distance, shadows are
currently "all or nothing" since per-light shadow color is no longer
customizable in the Vulkan renderer. This may result in noticeable
pop-in when leaving the shadow cutoff distance, but depending on the
scene, it may not always be that noticeable.
2022-02-25 15:17:35 +01:00
bruvzg
6325ed6705
Fix build for macOS / iOS with the statically linked MoltenVK after VMA update. 2022-02-25 11:52:54 +02:00
Pedro J. Estébanez
801741e787 vk_mem_alloc: Update to upstream + Adapt approach to small objects pooling
This updates VMA and instead of using the custom small pool approach from 4e6c9d3ae9, lazily creates pools for the relevant memory type indices, which doesn't require patching VMA.

Also, patches already merged upstream or not needed any longer are removed.
2022-02-24 14:30:55 +01:00
Bastiaan Olij
a78a9fee71 Implementing OpenXR driver 2022-02-23 12:02:24 +01:00
clayjohn
fe49244611 Use Filament specular models and parametrization 2022-02-22 19:39:41 -08:00
Bastiaan Olij
1034459d61 vkQueueSubmit needs pWaitDstStageMask sized to waitSemaphoreCount 2022-02-19 13:43:46 +11:00
Rémi Verschelde
488116e4d8
Merge pull request #58236 from bruvzg/win_min_fix 2022-02-18 09:07:10 +01:00
Rémi Verschelde
3a008fc1a2
Merge pull request #58186 from BastiaanOlij/fix_shader_features_init
Enable features we require when creating a Vulkan Device
2022-02-18 00:22:17 +01:00
bruvzg
0c27667124 [Windows] Fix Vulkan driver crash on sub-window minimization. 2022-02-17 13:34:08 +02:00
Bastiaan Olij
d7465d7c6a We were only getting our available shader features, now we also enabling them 2022-02-17 00:50:38 +11:00
Rémi Verschelde
b8b4580448
Style: Cleanup single-line blocks, semicolons, dead code
Remove currently unused implementation of TextureBasisU, could be re-added
later on if needed and ported.
2022-02-16 14:06:29 +01:00
reduz
4f73d3beb4 Add Particle Shader Userdata
* Adds optional vec4 USERDATA1 .. USERDATA6 to particles, allowing to store custom data.
* This data is allocated on demand, so shaders that do not use it do not cost more.
2022-02-15 19:20:31 +01:00
Fabio Alessandrelli
6b5634b96a [OS/Crypto] Add get_entropy to OS.
Implemented via `BCryptGenRandom` on Windows.
Implemented via `getentropy` syscall when available.
Implemented via `/dev/urandom` device as a fallback.

The `/dev/urandom` fallback can be disabled via the `NO_URANDOM` build
flag.

Note: The HTML5 version relies on emscripten file system urandom
device which itself uses the Crypto API when available or the plain
old not crypto-safe `Math.random()` otherwise.

Restore get_entropy.
2022-02-14 10:45:50 +01:00
Pedro J. Estébanez
4e6c9d3ae9 Add a separate pool for small allocations in Vulkan RD 2022-02-12 12:47:08 +01:00
Rémi Verschelde
67c6442844
Merge pull request #57628 from Calinou/shadow-atlas-default-enable-16-bits 2022-02-10 17:19:37 +01:00
Rémi Verschelde
1bdb82c64e
Fix typos with codespell
Using codespell 2.2-dev from current git.

Added `misc/scripts/codespell.sh` to make it easier to run it once in a
while and update the skip and ignore lists.
2022-02-10 12:30:19 +01:00
Bastiaan Olij
eb9d8ad44a Nitpicking, VK_VERSION_* have been deprecated, replaced by VK_API_VERSION_*. 2022-02-09 15:04:47 +11:00
Hugo Locurcio
e4eafb254a
Enable 16-bit shadow atlas by default in the RenderingServer methods
16-bit shadow atlases are already the default in the project settings,
but low-level methods used 24-bit shadows by default.

This makes low-level methods more consistent with the default project
settings to avoid accidental performance issues when users change
the shadow size at run-time.
2022-02-04 16:41:08 +01:00
Nathan Franke
8a0a3accee
simplify formatting scripts, add a clang-tidy script, and run clang-tidy 2022-01-29 04:41:03 -06:00
Fabio Alessandrelli
49297d937c [Net] Simplify IP resolution code, fix caching.
First, we should not insert into cache if the hostname resolution has
failed (as it might be a temporary internet issue), second, the async
resolver should also properly insert into cache.

Took the chance to remove some duplicate code with critical section in
it at the cost of little performance when calling the blocking
resolve_hostname function.
2022-01-29 01:56:36 +01:00
Rémi Verschelde
9686d680b7
Merge pull request #57116 from bruvzg/win_net_share 2022-01-28 11:03:23 +01:00
Rémi Verschelde
58324f4df8
Merge pull request #54574 from Ansraer/glow_map 2022-01-26 13:39:51 +01:00
bruvzg
cba8280515 [Windows] Add support for handling network share paths. 2022-01-24 16:22:59 +02:00
Rémi Verschelde
9b9440165b
Merge pull request #54890 from briansemrau/threadsafe-drawpute-lists
Make draw/compute lists threadsafe
2022-01-22 20:20:07 +01:00
Ansraer
90652b1755 add support for glow maps 2022-01-20 16:47:25 +01:00
Rémi Verschelde
cba2fd2e80
Revert "Add new scaling modes for splash screen"
This reverts commit fcc9f5ce39.

The feature is good but the implementation still needs more work.
A new PR will be made with a rework of this commit.
2022-01-19 16:09:52 +01:00
Rémi Verschelde
8b8e858778
Merge pull request #54489 from briansemrau/texture-delete-update 2022-01-19 10:10:54 +01:00
Samuel Pedrajas
fcc9f5ce39
Add new scaling modes for splash screen
Removes the `fullsize` option which is superseded by `stretch_mode`.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2022-01-18 23:29:11 +01:00