Commit graph

2562 commits

Author SHA1 Message Date
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
Omar El Sheikh
9988739332 Fix shader state caching when blend shapes used
Previously, conditionals set on the shader would change outside of the
_render_list function when blend shapes were used

This is an issue because the function keeps track of the previous shader
state to try to minimize state changes

Now we keep all this shader state change within the _render_list
function to ensure the saved previous state is correct
2022-03-05 16:33:17 -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
Rémi Verschelde
d0b446c6d5
Merge pull request #45372 from Firepal/prepass-nightmares 2022-02-11 15:19:26 +01:00
Firepal
ff55157d3f Don't use prepass threshold with alpha scissor 2022-02-11 12:01:15 +01:00
Rémi Verschelde
7a16bb2ee4
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.

(cherry picked from commit 1bdb82c64e)
2022-02-11 09:50:59 +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
Fabio Alessandrelli
aa3ef20fcb
[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.

(cherry picked from commit 49297d937c)
2022-01-31 22:54:25 +01: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
Rémi Verschelde
11a3fabc92
Merge pull request #56843 from Calinou/ssr-fix-background-line
Fix visible background line in intersections in screen-space reflections (3.x)
2022-01-18 07:56:46 +01:00
Rémi Verschelde
1ee44b2366
ImageLoader: Remove references to unsupported svgz extension
I don't see any reference to gzip/svgz supported in the nanosvg library,
and the handful of test gzip compressed svgz files I tried failed loading.

Also cleaning a couple missing includes in platform export code.
2022-01-17 10:52:32 +01:00
Hugo Locurcio
a80187f5bc
Fix visible background line in intersections in screen-space reflections
Adjusting the step grading by one resolves the issue without affecting
performance or introducing adverse artifacts.
2022-01-16 18:00:13 +01:00
Rémi Verschelde
22166639ed
Merge pull request #56366 from Calinou/async-shaders-use-in-editor
Use asynchronous shader compilation and cache in the editor if requested
2022-01-16 10:34:07 +01:00
Rémi Verschelde
31c7f13ea4
Merge pull request #56802 from jnlopar/oren_nayer_vert_lighting_bug
Fixes broken scene shader compile due to undefined 'diffuse_color' variable with Oren Nayar + Vertex Lighting
2022-01-15 09:19:43 +01:00
Jason Neufeld
36c3b87883 Fixes shader compile due to undefined 'diffuse_color' variable with Oren Nayer + Vertex Lighting 2022-01-14 13:09:30 -08:00
Rémi Verschelde
a627cdafc5
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-13 15:54:13 +01:00
Rémi Verschelde
8a192cd0ab
Merge pull request #55987 from bruvzg/wt🤎3 2022-01-10 16:43:56 +01:00
Rémi Verschelde
b197de6f5f
Fix typos with codespell
Using codespell 2.1.0.

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

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2022-01-07 00:14:54 +01:00
bruvzg
6f81a8ee2c
Fix multiple missing UTF-8 decoding.
(cherry picked from commit c69e0d16bc)
2022-01-06 21:44:40 +01:00
Rémi Verschelde
25369acff9
Merge pull request #51708 from Calinou/viewport-add-32bpc-color-depth 2022-01-04 14:30:24 +01:00
Rémi Verschelde
cc6e0e7fb3
Merge pull request #56161 from The-O-King/blend_shapes_octahedral 2022-01-04 14:09:49 +01:00
Brian Semrau
2c60c29340 Fix GPU particles transform feedback for WebGL 2 2022-01-03 00:20:42 -05:00
Hugo Locurcio
ae918c3041
Use asynchronous shader compilation and cache in the editor if requested
This provides more consistent behavior between the editor and running
project.
2021-12-31 02:20:29 +01:00
Omar El Sheikh
50ed674ec2 Fix Blend Shapes when Octahedral Compression is Used
Blend shapes did not take into account octahedral compressed vertex
attribute layouts and this resulted in incorrect lighting on the
resulting blended mesh

Now make the blend_shapes shader octahedral compression aware!
2021-12-22 10:00:12 -05:00
Bastiaan Olij
5fbc24f3e0 Fix issue with external textures being freed by Godot 2021-12-22 11:46:37 +11:00
Haoyu Qiu
e40bb68c05
Add / to the unix shortcut drive list
Also made `get_current_drive()` to pick the longest match on Unix.

(cherry picked from commit 67f04b381b)
2021-12-21 12:11:14 +01:00
Lucas Ângelo
9f68b4fea3
Trunc shader function fixed
the 'trunc' function was comparing integers with floats using the '>' operator, which is not supported in Android. This issue is now gone.
2021-12-18 17:50:58 -03:00
bruvzg
59085d5051
[Windows] Improve console handling and execute.
Always build with the GUI subsystem.
Redirect stdout and stderr output to the parent process console.
Use CreateProcessW for blocking `execute` calls with piped stdout and stderr (prevent console windows for popping up when used with the GUI subsystem build, and have more consistent behavior with non-blocking calls).
Add `open_console` argument to the `execute` to open a new console window (for both blocking and non-blocking calls).
Remove `interface/editor/hide_console_window` editor setting.
Remove `Toggle System Console` menu option.
Remove `set_console_visible` and `is_console_visible` functions.
2021-12-18 10:13:27 +02:00
Haoyu Qiu
e614a0e9fc Fix incompatible addition in auto exposure shader 2021-12-16 16:06:31 +08:00
Hugo Locurcio
21bc241a34
Only print OpenGL 2D batching status when in verbose mode
Since the new asynchronous shader compilation message prints to a
separate line (as it can be quite long), this frees up space in the
editor Output panel.
2021-12-10 22:53:52 +01:00
lawnjelly
7134ef90bb Fix leaking environment RIDs in GLES2
This PR adds the code necessary to correctly free environments in GLES2, which was previously missing causing them to leak.
2021-12-07 18:42:10 +00:00
Rémi Verschelde
ee1877e63e
Revert "Fix particles emitting at old location" 2021-12-07 10:52:39 +01:00
Rémi Verschelde
71d8ccbe9e
Merge pull request #55676 from RandomShaper/fix_layered_lightmap_3.x
[3.x] Fix atlassed lightmaps not visible on GL ES 3
2021-12-06 21:44:27 +01:00
Pedro J. Estébanez
c026c86255 Fix atlassed lightmaps not visible on GL ES 3 2021-12-06 19:06:59 +01:00
lawnjelly
6f4c0b95fc Fix incorrect RID cleanup in Rasterizers
Proper cleanup for GLES3 RIDs (preventing leak reports), and added missing destructor for RasterizerSceneGLES2.
2021-12-06 16:05:27 +00:00
lawnjelly
3d981b8265 Add option to use handles to RID
Adds an option to compile an alternative implementation for RIDs, which allows checks for erroneous usage patterns as well as providing leak tests.
2021-12-06 14:43:34 +00:00
Hugo Locurcio
4d4e972041
Only print message for get_modified_time() failure when in verbose mode
This error message was often displayed for no good reason when PCK
files were loaded in the editor.

Since file modification dates are secondary metadata, it's not
very important if it can't be retrieved successfully anyway.

(cherry picked from commit 5acb8a253e)
2021-12-02 17:28:57 +01:00
Fabio Alessandrelli
bbfe054175 [HTML5] Use compatibility function for glGetBufferSubData.
The "webgl/webgl2.h" include provides that function, but it's not
available in emscripten versions < 2.0.17 .

Since we need to support emscripten 1.39.9 (mono builds), this commit
adds a JS function in library_godot_display.js as a compatibility layer
for it, and implement glGetBufferSubData by funneling the call to that
function (so we don't have name collisions JS-side with recent emcc).

All those hacks are now moved to the platform directory instead of being
ifdefs inside the drivers implementations.
2021-11-26 15:58:04 +01:00
Hugo Locurcio
d7d35e4f73
Add const qualifier support for function arguments in shaders
This prevents the function argument from being reassigned within
the function.

Example:

    void test(const int t) {}
2021-11-19 21:20:23 +01:00
kobewi
a58736f129
Fix data directory of unnamed projects
(cherry picked from commit f6d16d55c6)
2021-11-18 13:47:52 +01:00