Commit graph

968 commits

Author SHA1 Message Date
lawnjelly
ad577e3c7e Fix 2D MultiMesh hierarchical culling
Fixes updating local bounds for MultiMeshes used in canvas items by introducing a back link.
2023-08-03 06:49:01 +01:00
lawnjelly
43e181a00a Single Compilation Unit build.
Adds support for simple SCU build.
This speeds up compilation by compiling multiple cpp files within a single translation unit.
2023-07-02 20:13:16 +01:00
Rémi Verschelde
29eeb461f2
Merge pull request #68738 from lawnjelly/faster_canvas_item
[3.x] Canvas item hierarchical culling
2023-06-27 08:40:22 +02:00
Rémi Verschelde
d644de8088
Merge pull request #76226 from paddy-exe/fix-node-position-view-3.x
[3.x] Fix `NODE_POSITION_VIEW` shader built-in
2023-06-07 14:46:24 +02:00
lawnjelly
b777a9e5f9 Canvas item hierarchical culling
Adds optional hierarchical culling to the 2D rendering (within VisualServer).

Each canvas item maintains a bound in local space of the item itself and all child / grandchild items. This allows branches to be culled at once when they don't intersect a viewport.
2023-04-25 20:17:33 +01:00
Aaron Franke
141783d90f
[3.x] Expose determinant in Transform2D, rename internal method 2023-04-22 13:47:47 -05:00
Patrick
67d3fe4075 [3.x] Fix NODE_POSITION_VIEW Shader Built-In 2023-04-18 22:11:41 +02:00
Alex Nogueira
01d0b9ad15 Fixed Whitescreen Issue in GLES2.0 Glow Setting
Replaced textureLod with texture2DLod in the tonemapping.glsl shader file.
2023-03-15 18:13:57 +01:00
Ansraer
0227fcc4cc fix shadows pass viewport calculation 2023-03-07 11:22:05 +01:00
Rémi Verschelde
a0ddc595a6
Merge pull request #71510 from lawnjelly/gles2_oct_unpack
GLES2 fix octahedral half float unpacking
2023-01-17 10:55:37 +01:00
lawnjelly
c6a428b3d6 GLES2 fix octahedral half float unpacking
The strides in _unpack_half_floats() were incorrectly calculated in the case where octahedral normals and tangents were in use.
2023-01-16 11:55:06 +00:00
Rémi Verschelde
1426cd3b3a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".

Backported from #70885.
2023-01-10 15:26:54 +01:00
Rémi Verschelde
6963ba631e
Fix typos with codespell 2022-12-15 12:26:59 +01:00
norrath-hero
aca8999cc9 Fix GLES 2 Spotlight Bug
Fixes https://github.com/godotengine/godot/issues/69759
Fixes https://github.com/godotengine/godot/issues/54343
Fixes https://github.com/godotengine/godot/issues/25526
2022-12-11 05:45:45 +08:00
clayjohn
f1bafe8131
Take FXAA samples from half-pixel coordinates to improve quality
(cherry picked from commit dbcc0fa2a6)
2022-11-30 15:39:00 +01:00
dzil123
aa0b91ca52 [3.x] Fix shader compiler asan out of bounds 2022-11-17 19:24:15 -08:00
lawnjelly
a300505066 Prevent drawing MultiMesh with zero instance count
Issuing a driver drawcall for MultiMesh with zero instances crashes some drivers.
2022-09-15 13:20:12 +01:00
lawnjelly
9b294b298e Fix GLES directional shadow uninitialized data
Valgrind shows directional_shadow.fbo accessed when uninitialized in directional_shadow_create.
2022-09-06 09:21:56 +01:00
Rémi Verschelde
36fc99158d
Merge pull request #63971 from paddy-exe/spatial-shader-built-ins 2022-08-08 15:50:25 +02:00
Rémi Verschelde
144f3ec94e
Merge pull request #51676 from Calinou/shader-add-hint-transparent-texture-3.x
Add `hint_transparent` to use a transparent black placeholder texture (3.x)
2022-08-05 22:34:05 +02:00
Patrick Exner
be3d331f26 Backport spatial shader built-ins
Backport of this PR: https://github.com/godotengine/godot/pull/63597
This adds these as new Built-Ins to Spatial Shaders
* Object's Position in World Space
* Camera Position in World Space
* Camera Direction in World Space
* Object's Position in View Space
2022-08-05 21:19:15 +02:00
Rémi Verschelde
ccbe083949
Merge pull request #63071 from lawnjelly/skinning2d_bounds 2022-08-05 19:34:48 +02:00
Hugo Locurcio
ab9a95f266
Add hint_transparent to use a transparent black placeholder texture 2022-08-02 23:32:07 +02:00
Rémi Verschelde
818f1eed31 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 14:53:37 +02:00
Hugo Locurcio
b03ceaba2f
Document support limitations for OmniLight cubemap shadows in GLES2 2022-07-18 22:18:56 +02:00
lawnjelly
18bb668a2e Fix skeleton 2D stale bounding rect
Adds special logic for handling skeleton bounding rect updates. Previously these were never being updated because the canvas item is never set to "rect_dirty".
2022-07-18 19:47:23 +01:00
Rémi Verschelde
772d071863 SCons: Properly track codegen script dependency for generated GLES headers 2022-07-02 15:52:42 +02:00
lawnjelly
f8df04ed50 More low priority redraw request cases
Some more cases of textures etc causing continuous updates in vital updates only mode are fixed.
2022-06-12 06:44:59 +01:00
clayjohn
f92141be13 Disable Alpha throughout Glow and FXAA code in order to avoid issues with transparent viewports 2022-05-26 11:15:35 -07:00
clayjohn
9927515254 Disable alpha in post process when using opaque framebuffer 2022-05-24 14:11:09 -07:00
clayjohn
027ec28126 Disable writing to alpha with opaque framebuffer 2022-05-24 10:30:49 -07:00
clayjohn
3374bae953 Fixed Bug where DoF incorrectly wrote to alpha channel amd bug with tonemap shaders 2022-05-18 13:19:42 -07:00
Hugo Locurcio
3762b40de7
Merge pull request #54585 from Kinwailo/fix_viewport_transparent_bg
Fix viewport with transparent bg changed to solid black if enable fxaa or debanding.
2022-05-16 08:28:36 +02:00
Kinwailo
b1a50ad805 fix post procressing with transparent bg and keep alpha channel of the tonemap shader output 2022-05-12 16:32:31 +08:00
clayjohn
33d825c50b Unpack blend shape arrays when necessary
Blend shapes need to be unpacked if the vertex array is being unpacked
2022-05-06 10:36:18 -07:00
Ansraer
2fb998bfbc Fix alpha scissor support 2022-03-11 16:18:19 +01:00
Rémi Verschelde
b6a6c90ea2
Merge pull request #58855 from akien-mga/3.x-gles2-fix-VersionKey-comparison 2022-03-07 14:31:43 +01:00
Rémi Verschelde
2dec5db5df
Merge pull request #58357 from BastiaanOlij/fix_external_viewport_texture 2022-03-07 13:18:33 +01:00
Rémi Verschelde
76df26b110 GLES2: Fix VersionKey comparison in ShaderGLES2::bind()
This was comparing arrays, GCC 12 raises a warning for it:

```
drivers/gles2/shader_gles2.cpp: In member function 'bool ShaderGLES2::bind()':
drivers/gles2/shader_gles2.cpp:80:71: error: comparison between two arrays [-Werror=array-compare]
   80 |         if (active != this || !version || new_conditional_version.key != conditional_version.key) {
      |                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gles2/shader_gles2.cpp:80:71: note: use unary '+' which decays operands to pointers or '&'component_ref' not supported by dump_decl<declaration error>[0] != &'component_ref' not supported by dump_decl<declaration error>[0]' to compare the addresses
```
2022-03-07 09:30:22 +01:00
Omar El Sheikh
733a84f7a4 GLES2 Compression on Blend Shapes Fix
When compressed vertex positions are used in a blend shapes mesh, we
need to make sure we set the w-component of the position vector to 1.0

When octahedral compression is used on normals/tangents, they need to be
converted to cartesian floats to be used for blend shapes

This conversion also changes the number of components of that vertex
attribute, which caused issues because previously there was an
assumption that you had the same number of components in the blend shape
buffer as you did in the original mesh's buffer (which is not true for
oct norm/tang)
2022-03-06 10:57:05 -05:00
Bastiaan Olij
7e2c4aac7e Fix external textures not working correctly with viewport texture 2022-02-22 14:24:34 +11:00
lawnjelly
522bce1159 Fixed Timestep Interpolation (3D)
Adds fixed timestep interpolation to the visual server.
Switchable on and off with project setting.

This version does not add new API for set_transform etc, when nodes have the interpolated flag set they will always use interpolation.
2022-02-16 09:41:23 +00:00
lawnjelly
3dc0e97d05 Fix incorrect buffer upload size in GLES2 draw_gui_primitive
The buffer upload size appears to have been incorrect for quite some time, which causes uploading from undefined memory.
2022-02-15 17:24:51 +00:00
lawnjelly
614dc363ab Fix GL buffer upload size bugs
Wrapper functions for uploading buffers to OpenGL take all sizes and offsets in bytes. Some buffer sizes are specified as units (e.g. float) so require conversion to bytes when calling the buffer upload functions.

Two such bugs have been fixed in blendshapes, and parameter names and comments have been changed to emphasize that sizes should be in bytes.

In addition DEV_ASSERTS in the upload wrappers have been changed to ERR_FAIL.
2022-02-14 10:56:06 +00:00
Firepal
ff55157d3f Don't use prepass threshold with alpha scissor 2022-02-11 12:01:15 +01:00
lawnjelly
b15ad8e786 Fix for S3TC on Android and IOS devices
On some platforms, exporters are prevented from exporting S3TC textures. This causes problems if the .import file contains a reference to such a texture - the exported project will attempt to load the S3TC, fail, and probably crash.

This PR prevents this problem by faking lack of hardware support for S3TC on the affected platforms. This prevents the engine attempting to load the S3TC and avoids the problem.
2022-02-09 08:45:24 +00:00
Omar El Sheikh
bf5b2f48e6 Re-fix Disabling Half Floats on iOS
A previous change missed setting a flag that specified whether half
floats were being used on vertex positions when in the GLES2 driver

This caused errors with the vertex buffer when platforms (specifically
iOS) which do not properly support half float vertex attributes on
GLES2, try to remapt the vertex buffer to stop using half floats
(in this case that remapping never happened and caused artifacts)

Re-enable setting that flag to fix rendering issues on these platforms
2022-02-05 21:06:09 -05:00
lawnjelly
a0c6d16c90 Add editor vital redraws only option
When editor continuous redraws is switched off, the editor only redraws when a redraw_request was issued by an element in the scene. This works well in most situations, but when scenes have dynamic content they will continuously issue redraw_requests.

This can be fine on high power desktops but can be an annoyance on lower power machines.

This PR splits redraw requests into high and low priority requests, defaulting to high priority. Requests due to e.g. shaders using TIME are assigned low priority.

An extra editor setting is used to record the user preference and an extra option is added to the editor spinner menu, to allow the user to select between 3 modes:

* Continuous
* Update all changes
* Update vital changes
2022-02-02 11:26:45 +00:00
Rémi Verschelde
aa6465cd5b
Fix style error from previous merge 2022-01-22 16:23:28 +01:00
Rémi Verschelde
6c0c0c4b29
Merge pull request #54165 from Calinou/directional-shadow-runtime-change-3.x
Allow changing directional shadow size at run-time
2022-01-22 15:25:09 +01:00